我有一个由1200个探针组成的数据(行)和两组9列的数组。前九列命名为“肯定”,后九列命名为“否定”。我想通过使用方框图选择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")发布于 2013-08-17 13:05:00
我想这就是你想要的:
set.seed(1)
probes <- data.frame(matrix(rnorm(1200*18),ncol=18))
f<-c(rep("positive", 9), rep("negative", 9))
myrows <- sample(1:1200,12,FALSE)
boxplot(unlist(probes[myrows[1],])~f) # first plot
for(i in myrows){
boxplot(unlist(probes[i,])~f)
Sys.sleep(1) # wait for each plot for 1 sec
}https://stackoverflow.com/questions/18288865
复制相似问题