How To Make Boxplot For Several Probes
1
0
Entering edit mode
11.3 years ago
Curious Mind ▴ 10

Hi, I have a dataframe of 1200 probes (in rows) and two sets of arrays of nine column each. The first nine columns are named as "positive" and the next nine as "negative". I want to show that the expression is normal by choosing 12 random probes using box plot. My code looks as follows:

f<-c(rep("positive", 9), rep("negative", 9)) for(i in seq(from=1, to=1200, by=10)){

boxplot(probes[i]~f,col="lightblue",main="Expression of genes studied Cells")

} But I am getting the following error: Error in model.frame.default(formula = probes[i] ~ f) : variable lengths differ (found for 'f')

If I use the box plot for a single probe it works fine. I get two boxes , one corresponding to "positive" and another to "negative". Thanks

r • 2.9k views
ADD COMMENT
2
Entering edit mode
11.3 years ago
Michael 55k

You need to select rows from the data frame [i,] vs. [i] try:

     boxplot(probes[i,]~f,col="lightblue",main="Expression of genes studied Cells")
ADD COMMENT

Login before adding your answer.

Traffic: 2128 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6