在子集合对象中循环并将输出存储在R中

在子集合对象中循环并将输出存储在R中,r,string,for-loop,subset,R,String,For Loop,Subset,通过output\u ens10,我有10个名为output\u ens1的对象。我想从每个对象中提取一段数据,对其执行算术运算,并将其添加到新对象中。我一直在尝试使用for循环和子集。下面是我的循环的一个示例对象 ## Values used elsewhere in model output processing num_sp <- 46 # Enter the number of species modeled num_steps <- 36 # Enter the numb

通过
output\u ens10
,我有10个名为
output\u ens1
的对象。我想从每个对象中提取一段数据,对其执行算术运算,并将其添加到新对象中。我一直在尝试使用for循环和子集。下面是我的循环的一个示例对象

## Values used elsewhere in model output processing
num_sp <- 46  # Enter the number of species modeled
num_steps <- 36 # Enter the number of months modeled
num_ens <- 10 # Enter the number of runs in the ensemble

## example object of same dimensions
output_ens1 <- matrix(data = c(1:11880), ncol = 330, nrow = 36)

hist <- c(1:num_ens)
for (i in hist)
{
  hist[i] <- as.name(paste0("output_ens", i))[num_steps,8+num_sp*7]/1000
}
我想要num_steps(第36行)和8+num_sp*7(第330行)列值除以1000并添加到object
hist
。在本例中,值11.88(11880/1000)将被设置为
hist[1]
。我已经尝试了多次迭代,并且相信我的问题在于读取要成为子集的对象的名称。我应该往哪个方向走?

用这个代替:

get(paste0("output_ens", i))

哇!在我尝试的每件事中,我跳过了“得到”。。。谢谢
get(paste0("output_ens", i))