This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How To Make Boxplot For Several Probes

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

1 answer

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")

Log in to answer this question.