Was it helpful?

Question

How to make list of data frames in R?

R ProgrammingServer Side ProgrammingProgramming

This can be done by using list function.

Example

> df1<-data.frame(x<-1:10,y<-rnorm(10,0.5))
> df2<-data.frame(x<-runif(5),y<-rnorm(5,2.5))

Creating list of the above data frames −

> dataframe_list<-list(df1,df2)
dataframe_list
[[1]]
x....1.10 y....rnorm.10..0.5.
1 1 -1.18300381
2 2 0.43870736
3 3 0.20725102
4 4 2.30063996
5 5 -0.11919648
6 6 0.67967756
7 7 -0.91059379
8 8 -0.62887635
9 9 0.93796333
10 10 -0.05017542
[[2]]
x....runif.5. y....rnorm.5..2.5.
1 0.4734924 2.918810
2 0.1173504 1.723042
3 0.7463292 2.230573
4 0.5444740 2.155880
5 0.1299897 2.237451
raja
Published on 06-Jul-2020 18:27:16
Advertisements
Was it helpful?
Not affiliated with Tutorialspoint
scroll top