Question: plotting boxplots in R
0
gravatar for vinayjrao
21 months ago by
vinayjrao150
JNCASR, India
vinayjrao150 wrote:

Hi,

I have a file consisting 3 columns (patient ID, subtype, rpkm - all of this for one gene), sorted by the second -

sample     subtype     rpkm

patient1     LumA     0.1253201

patient2     LumB     3.00531

I want to plot a box plot for this gene to check the variation for different subtypes. Could someone please guide me through it from the beginning, i.e. calculating the average and standard deviation across each sample for a particular subtype?

Thanks.

box plots R • 1.9k views
ADD COMMENTlink modified 21 months ago by lakhujanivijay4.6k • written 21 months ago by vinayjrao150
2

You can find detailed documentation ggplot2-boxplot.

ADD REPLYlink written 21 months ago by arta540
2
gravatar for lakhujanivijay
21 months ago by
lakhujanivijay4.6k
India
lakhujanivijay4.6k wrote:

Consider a file like this one

[mycom]$ cat test.txt

sample  subtype rpkm
patient1    LumA    0.1253201
patient2    LumB    3.00531
patient3    LumA    4.00531
patient4    LumB    3.00531
patient5    LumB    2.00531
patient6    LumB    1.00531

Step 1. Read file

file=read.table("test.txt", stringsAsFactors=FALSE, header=TRUE,colClasses=c("character","factor","numeric"))

Step 2. draw boxplot

boxplot(rpkm ~ subtype, data=file, col=c("gold","darkgreen"))

Here is the output Here is the boxplot

You can interpret the boxplot using this link

ADD COMMENTlink modified 21 months ago • written 21 months ago by lakhujanivijay4.6k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2009 users visited in the last hour