我有1200个探针(行中)的数据框和两组数组,每组九列。前九栏命名为“正面”,后九栏命名为“负面”。我想通过使用盒图选择12个随机探针来表明表达正常。我的代码如下:如何创建多行的箱线图?
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")
}
但我收到以下错误:
Error in model.frame.default(formula = probes[i] ~ f) :
variable lengths differ (found for 'f')
如果我用箱形图的正常工作一个探头。我得到两个箱子,一个对应于“积极的”,另一个为“负面”:
f<-c(rep("positive", 9), rep("negative", 9))
genex<-as.numeric(dat.fp.labeled["NM_139321.1_psr1_at",])
boxplot(genex~f,col="lightblue",main="Expression of NM_139321.1_psr1_at samples")
你能提供关于结构的更多细节你的数据?探测器是一个矢量吗?如果没有,那么你在调用'boxplot'时会错误地编制索引。此外,您当前的代码将创建120个箱型图,但我不认为这就是您想要做的... – Thomas
可能重复[按两个条件分组的多个箱型](http://stackoverflow.com/questions/13124827/多箱线形 - 按两条件分组) – Metrics
它是一个数据帧,包含1200行和18列.18列有两种类型。前9名被命名为“正面”,后9名被命名为“负面”。如果我为单排而言,它可以很好地生成两个框,每个框用于正面和负面。代码:是:f <-c(rep(“positive”,9),rep(“negative”,9)) genex <-as.numeric(dat.fp.labeled [“NM_139321.1_psr1_at”,])boxplot(genex〜f,col =“lightblue”,main =“NM_139321.1_psr1_at样本的表达式”) – user2649495