Hello members!!
I have a raw data which consists of 45 samples and their intensities. This is a microarray data expression. I have comverted this into a dataframe. However, I am confused how to plot a boxplot of all these 45 samples and also group them as "normal" and "tumor". Please help me out with this The code i used is as follows
read_data <- ReadAffy() ##read the raw .CEL files
ph=read_data@phenoData#annotation of the data
ph$sample
ph@data
ph@data[,1]=c("NB","ND","TB","NB","ND","TB","TC","NB","ND","TB","TC","NB","ND","TB","TC","NB","ND","TB","TC","NB","ND","TB","NB","ND","TB","TC","NB","ND","TB","TC","NB","ND","TB","TC","NB","ND","TB","TC","NB","ND","TB","TC","NB","ND","TB")
sampleNames=vector()
logs=vector()
for (i in 1:45)
{
sampleNames=c(sampleNames,rep(ph@data[i,1],dim(pmexp)[1]))
logs=c(logs,log2(pmexp[,i]))
}
logdata <- data.frame(logint=logs,sampleName=sampleNames)
the structure of this dataframe is as follows
> str(logdata)
'data.frame': 11155455 obs. of 2 variables:
$ logint : num 8.79 9.74 11.09 12.38 12.36 ...
$ sampleName: chr "NB" "NB" "NB" "NB" ...
> head(logdata)
logint sampleName
1 8.791163 NB
2 9.736402 NB
3 11.091435 NB
4 12.376125 NB
5 12.363587 NB
6 11.574594 NB
> p <- ggplot(logdata,aes(sampleName,logint))
> p+geom_boxplot()
Can someone please guide me how to create a boxplot using ggplot2 in R, of these 45 samples, by grouping them as normal and tumor samples, as the above code gives me the boxplot of only four samples. I need to print them all together
Thank you
in the absence of data, i suggest following:
Instead of boxplot, consider using violin plot with jitter.
Thank you for your response. I have edited to repost the data. Could you now let me know where am i going wrong