A user created a list that contains a lot of dataframes.Now how to unlist all the data frames separately?

879    Asked by shukhdevsingh in Data Science , Asked on Dec 2, 2019
Answered by shukhdev singh

To unlist all the dataframes from a list, we have to build a for loop and use assign() function to unlist such as

Let us create a some sample dataframes

df.list <- list(data.frame(x = 1:3, y = c(10, 20, 30)),

                data.frame(x = 4:6, y = c(40, 50, 60)),

                data.frame(x = 7:9, y = c(70, 80, 90)))

Now we will unlist every single data frames with the following code

for (i in seq(df.list))

     assign(paste0("df", i), df.list[[i]])



Your Answer

Interviews

Parent Categories