【发布时间】:2020-12-31 00:14:19
【问题描述】:
我想创建具有相同维度的 18 空矩阵,命名为 mat10ci、mat15ci、....、mat95ci。我试过下面的代码
for( s in seq(10,95,by=5)){
paste0("mat",s,"ci")=array(NA, dim = c(10, 20))
}
我遇到了这个错误
target of assignment expands to non-language object
感谢您的帮助。
【问题讨论】:
-
如果你打算以同样的方式处理多个矩阵,我强烈建议你将它们放在
list中,与list of frames 讨论非常相似。例如,lst_of_mtx <- lapply(seq(10,95,by=5), function(ign) array(dim = c(10, 20)))。 -
或者坦率地说,您可以将其作为单个 3d 数组处理,如
array(dim=c(10, 20, 18))。