将所有数据框放在一个列表中

时间:2019-05-20 20:11:24

标签: r

我想将所有数据框都以列表格式放置,以便我可以轻松地合并所有数据框,而无需键入每个数据框的名称并仅提及列表。

# importing netcdf files

files_so2 =  list.files(  pattern =  "*.nc" )

# reading each netcdf as a dataframe


for (i  in  1:length( files_so2 ) )  assign( 
                                             files_so2[i], as.data.frame( 
                                                                          brick(  files_so2[i] ),  xy = T   ) )

# I want to put all the files in the list so that I can perform the following


data <- Reduce (  function(x,y)  {merge(  x = x,  y  = y , by = c("x" , "y") )} , list_data)

我在R中导入了72个数据帧,现在想将它们全部放入一个列表中,例如代码中提到的list_data来执行合并。

0 个答案:

没有答案