连接列表然后制作箱线图
假设我有两个列表:
temp<-c("con.sin.results","sin.results","exp.results")
Temp<-c("[,1:16]","[,17:32]","[,33:48]","[,49:64]")
temp 中的每个变量都包含 1000 个观测值和 64 个变量。我想做的是创建一个双循环,以便我可以根据样本大小创建箱线图(这样每个箱线图将有 16 个框,根据 Temp),即我会得到 boxplot(con. sin.results[,1:16]),然后是 boxplot(con.sin.results[,17:32]) 等。
考虑到这个目标,我得到了以下几点:
for (l in temp){
for (L in Temp){
windows()
par(mfrow=c(2,2))
A<-noquote(paste(noquote(l),noquote(L),sep=""))
boxplot(A)
}
}
不幸的是,这会抛出一个错误对我:
x[floor(d)] + x[ceiling(d)] 中的错误:二进制的非数字参数 运算符
我哪里出错了?我应该调整什么?
Let's say that I have got two lists:
temp<-c("con.sin.results","sin.results","exp.results")
Temp<-c("[,1:16]","[,17:32]","[,33:48]","[,49:64]")
Each of the variables in temp contain 1000 observations and 64 variables. What i am trying to do is create a double loop so that I can create boxplots based on sample size (so that each boxplot would have 16 boxes, as per Temp) i.e I would get boxplot(con.sin.results[,1:16]), then boxplot(con.sin.results[,17:32]) etc.
With this goal in mind, I've gotten to the following point:
for (l in temp){
for (L in Temp){
windows()
par(mfrow=c(2,2))
A<-noquote(paste(noquote(l),noquote(L),sep=""))
boxplot(A)
}
}
Unfortunately, this spits out an error at me:
Error in x[floor(d)] + x[ceiling(d)] : non-numeric argument to binary
operator
Where am I going wrong? What should I adjust?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我正确理解你的问题,这或多或少就是你想要的:
你现在可以轻松地执行以下操作:
If I understand your question correctly, this is more or less what you want:
You can now easily do something like:
这是我的主管提出的:
This is what my supervisor came up with: