Home > Software design >  Unlist a list of dataframes in R
Unlist a list of dataframes in R

Time:05-24

I have a list of dataframes that I have created using

list_dataframes = list(dataframe_1, dataframe_2...)

And now I wonder how to unlist this list.

I have searched for it and found this solution:

list2env(list_dataframes ,.GlobalEnv)

in this old question: Unlist a list of dataframes

However, when using that solution, the following error arises:

Error in list2env(list_dataframes, .GlobalEnv) : 
  names(x) must be a character vector of the same length as x

Any idea why it's happening?

Thanks!

CodePudding user response:

The error is a result of passing a list without names

list2env(list(1, 2, 3), .GlobalEnv)

Error in list2env(list(1, 2, 3), .GlobalEnv) : names(x) must be a character vector of the same length as x

list2env(list(a= 1, b = 2, c = 3), .GlobalEnv)
<environment: R_GlobalEnv>
  • Related