Create Simple Graphs in R Studio | R Beginners Graphs Tutorial | Bar Plot | Scattered | Box Plot

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Do people actually use the base plotting capabilities of R? Sure it's a step up from Excel, but in my experience you're almost always better of learning ggplot2 (and the rest of the tidyverse packages while you're at it).

👍︎︎ 15 👤︎︎ u/dodslaser 📅︎︎ Sep 25 2020 🗫︎ replies
Captions
[Music] [Music] welcome to bioinformatics with baby channel my name is baba chan bananapali i'm an associate professor in bioinformatics so today's video we are going to make one more one more session on our program that is how we can create a basic plots using the r as i told you in a previous tutorial so we are going to make a series of videos on our programming where we are going to learn about very fundamentals or basics of the r so in this video i'm going to tell you how we can generate a basic plots like the bar graphs box plots pie charts and also the scatter plots by using the r program if you have any troubleshoot or if you have any concern any questions regarding the bioinformatics you can post your question in our bioinformatics group in facebook okay so please follow this one along with the sun we have a page in instagram also uh just check just like the informatics dot bb so where here in this instagram page we are providing a available academic free softwares we are pasting here and also we are writing a description what is the use of that software and also uh the links for the downloading of that particular software so let us start so here what we are going to learn is so today we are going to learn how we can load the data files into the r various data file format can be acceptable by the r but you have to give a specific commands to the r where it able to load the specific files so here we are going to i am going to show you three different file formats for you uh excel csv format file and also text format file so also we are going to generate the various basic plots so advanced plots we are going to discuss in the next session so in this session we are going to learn about the very basic plots like bar plots dot plot scatter plot pie charts and box plots using the r program so let us start first we will try to import import.csv format file in our program okay so here we're doing this one so we are going to write this one as a format one so we have to copy with our information in forward point read dot csv file so file dot choose okay so here i created that csv format file you click on this so any so three files are there so i'm going to produce this one head format one okay so you can see here that these are the header files these are the view of that csv format file okay so let us see about second format file for the excel one we have to load additional library we have to install the additional library so to load the excel sheet directly our spreadsheet directly into the r so we have to install this package okay so successfully install this one read excel library okay so now we can write as a format to inform it to okay so as you can see here now read excel different options are available for you so here i'm going to select this one xlx format based upon type of format you're working on okay so here file dot choose okay so hit enter so here my file is you can check this one the file name so the file name is the one here you can see here that this xlsx format file okay so click hit ok so now we can see here head comment two okay so now you can see here it's automatically showed the information for you like this so now we loaded the excel format also now if you want to load the text format text format one thing you have to do if you are trying to load the text format file you have to convert that one into tab or delimited format file format three okay this is formattery and we are going to load this server data here read dot delimited daily okay file the same thing choose so hit the enter to just stop here again so you can see here this is a text format file okay you can see here if we select this properties it's a text format file so here i selected text format file it loaded now we can see it now you can see here so like this you can upload the various kinds of files in our program so let us start we will create a bar plot uh using our program okay so barcode can be created by a simple function in r called as a bar plot okay so using this option we can create this very simple part plot so if you want to know about the help of about this any any command if you want the help of any command you simply need to type here a question mark here uh on this one hit the enter so you will see the description about each and every the command what is the usage assert what are the argument you can use you can get all this information here along with the example also okay any commands so whatever the commands if you don't know the command or what are the input option what is the output options are there what is the values what is the argument you can give for the specific function you just simply need to type the question mark here question mark along with that particular function it will be resist by you okay so here let us try with this box plot so we we need to supply a vector or matrix to this function if we are able to supply the vector the plot will have the parts with their height equals the element elements in the vector so for example here so we are going to take one example here let us write this one as a bar plot or let's write this a bb okay so i'm going to write as a bp one bp one will load this file so read dot csv okay so here file dot choose hit enter okay so here we are going to select the file so i'm going to select any one of the file here i'm going to select this sugar.csc file okay so here's your.csv file so i selected this one now it's time to check the plot so simply you can type here like a bar plant so here we give the file name as a pp1 okay so here dollar symbol we have to give now what is a particular uh vector we have to select see i'm going to select the sugar level okay sugar level if you click on enter it will show you information for you okay you can see here these are the various samples i have various samples i have and uh and this is a sugar levels sugar levels of the each and every patient's patient list we have okay so if you want to add a little bit more like if you want to add the names names for this sample and also labels colors we can change this one so simply here okay so i'm going to label this one names so i want to extend this graph also i just showing 150 150 mg per 150 dl okay so it's showing up to the 150 only i'm going to extend this one let's say this one to 200 so here first command you have to write volume okay so while in c is the y axis we need to improve so c 0 to 200 okay 0 to 200 so if you click hit enter now you can see here the scale has been changed now again i'm going to add a few more labels to it like names names here so here bp1 so what is up exactly names we needed just click here serial numbers okay so if you click this one i will show you here you can see here samples has been added okay so the sample numbers has been added you can see here all the samples has been added in this list so here i'm going to add few more things like what is the labels for the x-axis and y-axis x-lab okay x-label and here sample okay and a y label and here glucose level okay so glucose level so what is the plot name so here main okay so here main so type here blood glucose level blood glucose okay so so if you want to add colors like for example i just want to change it to the red color or blue color okay so here i'm going to type as a color okay so here i'm going to give two different colors to it so see okay so you can see here i'm going to just give it two different colors if you want to extend more so you can add different colors here so two five seven okay so you can see here so i added three different colors for the uh for each and every so here the samples here so now you can save this information okay so here export image you can see here you can export this image save image in a png format file you can save in the desktop file so this is how we can create a very simple graph by using this uh simple command so if you want to see this one is a horizontal way we can do we can select this option so here at the time we have to change this labels x here and y here okay so here the x axis if you want to select the horizontal artist is equal to true okay so hit enter now you can see here now it has been created in a horizontal manner so next one we are going to look on to the dot plot if you see the dot plot it is also consist of a the same numerical vectors and also label vector so by using this function we can create a dots we can create a dot plots very easily in our program okay so let us see this one how we can use this dot plot for our data so i'm going to use the same data set so here i'm going to write down the dot chart okay dot chart so here bp1 the same dataset i'm using okay so here i'm going to use the sugar level sugar level okay so hit enter you can see here now it has been created the dot chart for you so if you we don't have a there is missing labels are there so we can we have to label them so what is the sample number are there and this one and also you can see here it's very plain okay so you can change the color symbols all these things so let's do this one so here i'm going to add a labels labels okay here let's go p1 serial number okay so if you hit this one it will add the labels for you okay so it will add the levels for you on x axis sorry on y axis so here so i'm going to use the colors also okay so the color i'm going to use a blue so if you hit this one it will show you this color for you okay so if you if you want to change this one if you want to add a different uh labels or different type of symbols you can use this option for example if i want to use the different option called as one here so you can see here it will show a different option for you for example if i want to show you 16 if you want now you can see here it's completely changed you can even increase the size of this label also okay so six okay so here two okay so now you can see here the graph has been changed now you can see the intensity of this graph has been completely changed now you can we can use the same way you can label them xlab x label is equal to so sugar level glucose level okay so y lab is equals to sample okay the main is equals to here okay so hit enter now you can see here uh the create job has been created now let's create a pie chart so before we draw the threshold i just want to load one more data here for the pie chart so let us load this one in mutation okay so here read dot csv file dot choose hit enter okay so here in desktop so here i supply chart click enter so here project has been downloaded outstanding by chat pi okay so here notation okay so what are the sign here number of mutations okay so here also you're going to get the vector numerical vector so here labels tables rotation okay type type of mutation so color something you can give the different colors are single color to it color so nine okay so main genetic variation hit enter now you can see here so the plot has been created against the percentage of deletion is very high compared to the frame shape notation missions and synonymous and insertion insertion there is also very big compared to this one next we are going to create a histogram okay so let's write the histogram east okay so i'm going to use the previous data set that's fbp one so let's enter this so we cannot we can label them the same way slab level okay frequencies name okay you can change the color also okay so let's like this so you can generate the histograms also for this by using this data set okay so next one is so we're going to create a a cluster plots cluster plot by using the option called as a plot so plot that is the plot so keep one so let us select the age here color now you can see here so the age versus the glucose level here the two factors we have given okay so allah here you can change the same thing the the labels we see here for example if i want to add 22 you can see the label has been changed so i prefer to use the 16 one okay so here hit enter okay if you want to increase the dot size also you could do that one the same thing like cx is dx2 okay so it can increase the size of the dot so next one the last one we are going to seek one more one more data set one more uh plot that is box plot box plot okay so we are going to use a different data set for this one so let us type here better colon metal a file choose hit enter so here i have one data set called as a metabolom data set okay so here open so now destroy the box plot box plot okay so here metro volume so you can see here the various classes are there okay so these are different amino acid and their intensities intensities this is a metabolic data set so i am going to check the intensity of ironing when compared with the when check with the metabolic second data set that is second option like glucose okay so names we have to write the names see sequels too so here the first one is and the second one is okay and the colors we're going to get different colors to it so let's see so i'm going to give it four four six you can see here the plot has been created if you want to change the colors also you can do it so let us add one more group here tap so i'm going to add one more group close it all okay as you can see here so i just started the glycerin also so now you can now label them okay the same way so what we have data for with other graphs slap lab other nicest so concentration and pain is equal to so like this we can create a various graphs by using the art program session we are going to learn about some more advanced graphs some more advanced libraries we are going to check like a gg plot so where we can create a very high resolution and very interactive graph compared to the normal r plot programs okay thanks for watching if you like this content please like share and subscribe to our channel [Music] you
Info
Channel: Bioinformatics With BB
Views: 19,465
Rating: 4.9512196 out of 5
Keywords: R Plots, R Basic Plots, Bar plots, box plots, pie chart, histogram, dot plot, R code, Introduction to R, R Programming, bioinformatics, data analysis, biological data, biological data analysis using R, computational bology, BigData, introduction R, R for Beginners, R language, circos, heatmap, beginner code R, learn R, Biology R, Biologist with R, R Programming language, R installation, r programming for beginners, r programming tutorial, r programming for data analysis
Id: yBvOS91jIXI
Channel Id: undefined
Length: 28min 41sec (1721 seconds)
Published: Fri Sep 25 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.