0 votes
1 view
in R Programming by (4.4k points)

I have the following data frame

empid <- c(1:4)

empname <- c("Sam","Rob","Max","John")

empdept <- c("Sales","Marketing","HR","R & D")

emp.data <- data.frame(empid,empname,empdept)

stdid <- c(1:4)

stdname <- c("Alex","Mary","Jim","Jerry")

stdsection <- c("Eco","Sci","Soc","Pol")

std.data <- data.frame(stdid,stdname,stddept)

How can I make a list of these data frames? 

1 Answer

0 votes
by (23.2k points)
edited ago by

In R programming, we can directly use the 'list()' function to add data frames to a new list.

In your case,

Mylist <- list(emp.data,std.data)

The above statement will add the two data frames 'emp.data' and 'std.data' to a list called Mylist.

You can access the elements in the above list by using the following code

Mylist[[1]] , Mylist[[2]]

and so on.

If you want to explore more in R programming then watch this R programming tutorial for beginner:

...