从R中的for循环内部调用列

从R中的for循环内部调用列,r,for-loop,get,paste,R,For Loop,Get,Paste,我基本上希望能够从for循环内部调用列(实际上是两个嵌套的for循环),使用循环的pass()和I(j…)值来访问 我的数据以灵活的方式对各个列进行帧处理 #for the showcase I use the standard cars example r1 <- cars r2 <- cars # in case there are more data to consider I would want to add, ore remove further with out

我基本上希望能够从for循环内部调用列(实际上是两个嵌套的for循环),使用循环的pass()和I(j…)值来访问 我的数据以灵活的方式对各个列进行帧处理

#for the showcase I use the standard cars example
r1 <- cars  
r2 <- cars

# in case there are more data to consider I would want to add, ore remove further with out changing the rest 


# here I  am entering the "dimension" of what I want to compare for the showcase its only one
num_r <- 2    #total number of reactors in the experiment



  for( i in 1:num_r)
  {
    # shoud  create proxie variable to be processed further
    assign(paste("proxi_r",i,sep="", colapse="") , do.call("matrix",    
           list(get(paste("r",i,"$speed",sep="", colapse="" )))))
    # further operations of gluing and arranging data follow so they  fit tests formatting requirements

  }
但当典型r1$速度时,它显然存在

我搜索了“循环中不存在R对象”、“使用paste()访问循环中的变量”、“foor循环和对象”、“do.call inside循环”以及类似的内容

有什么可以绕过get()的吗?这样我就不必研究环境这个话题了,这样我就可以保持循环的灵活性,这样我就不必在每次更改实验配置时都重新编辑脚本了,这真的很耗时,而且允许很多错误潜入其中

由于大量使用excel宏,数据的大小使excel崩溃,这里的每个人都在使用excel宏多次:),因此无法返回到Convart区域。 我现在正试图通过一本R静力学的书,以及大量的谷歌搜索和阅读教程来深入研究R编程,所以请原谅我天真的方法和糟糕的英语。
我会非常感谢任何提示,因为我现在感觉有点卡住了。

这是一个常见的困惑。您已经创建了一个对象名“r1$speed”,即完整的字符串。这与由
$speed
子集的对象
r1
不同

尝试使用
get(粘贴('r',i,collapse='',sep='')$speed

Error in get(paste("r", i, "$speed", sep = "", colapse = "")) : 
object 'r1$speed' not found