我运行循环,我需要在列表中存储一些图。有时候它们的类型不同,因为当我无法计算实际图时我需要插入虚拟图。
为什么基础图不能存储在列表中?
library(effects)
df=data.frame(response=sample(10,10),predictor=c(1:10))
model0=lm(response~predictor,df)
plot.list=list()
plot.list[[1]]=plot(Effect("predictor",model0))
plot.list[[2]]=plot(predictor~response,df)
plot.list
答案 0 :(得分:0)
尝试存储功能
object
然后
x <- list()
x[[1]] <- function(){plot(1)}
x[[2]] <- function(){plot(2)}