Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 向构造的名称添加数据帧_R - Fatal编程技术网

R 向构造的名称添加数据帧

R 向构造的名称添加数据帧,r,R,我有这个 因为(我在1:10) 在它里面,我有一个数据框: e、 g df我建议分配,如下所示: for(i in 1:100){ df <- data.frame(x = rnorm(10),y = rpois(10,10)) assign(paste('df',i,sep=''),df) } for(1:100中的i){ df我建议分配,如下所示: for(i in 1:100){ df <- data.frame(x = rnorm(10),y = rpois(1

我有这个

因为(我在1:10)

在它里面,我有一个数据框: e、 g


df我建议
分配
,如下所示:

for(i in 1:100){
  df <- data.frame(x = rnorm(10),y = rpois(10,10))
  assign(paste('df',i,sep=''),df)
}
for(1:100中的i){

df我建议
分配
,如下所示:

for(i in 1:100){
  df <- data.frame(x = rnorm(10),y = rpois(10,10))
  assign(paste('df',i,sep=''),df)
}
for(1:100中的i){

df您可以将循环的输出存储在列表中:

set.seed(10)
x = list()

for(i in 1:10){
  x[[i]] <- data.frame(x = rnorm(100), y = rnorm(100))
  }
当然,您也可以命名列表中的元素:

names(x) = letters[1:10]

x[["a"]]


              x           y
1    0.01874617 -0.76180434
2   -0.18425254  0.41937541
3   -1.37133055 -1.03994336
4   -0.59916772  0.71157397
5    0.29454513 -0.63321301
6    0.38979430  0.56317466
...

您可以将循环的输出存储在列表中:

set.seed(10)
x = list()

for(i in 1:10){
  x[[i]] <- data.frame(x = rnorm(100), y = rnorm(100))
  }
当然,您也可以命名列表中的元素:

names(x) = letters[1:10]

x[["a"]]


              x           y
1    0.01874617 -0.76180434
2   -0.18425254  0.41937541
3   -1.37133055 -1.03994336
4   -0.59916772  0.71157397
5    0.29454513 -0.63321301
6    0.38979430  0.56317466
...

你知道我怎样才能在另一个循环中访问这些赋值吗?@Nathaniel
get(粘贴('df',I,sep='')
但如果你需要它,你可以使用list来代替。
list of_df你知道我怎样才能在另一个循环中访问这些赋值吗?@Nathaniel
get(粘贴('df',I,sep='')
但如果您需要,可以使用list代替。
list of of of
names(x) = letters[1:10]

x[["a"]]


              x           y
1    0.01874617 -0.76180434
2   -0.18425254  0.41937541
3   -1.37133055 -1.03994336
4   -0.59916772  0.71157397
5    0.29454513 -0.63321301
6    0.38979430  0.56317466
...