Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to bind list data by row in R

Tags:

list

r

rbind

I have a problem in binding list by row in R. My list data set is:

id:1
data$k: 1
id k b c
1 1 1 3
----------------
data$k: 2
id k b c
1 2 1 4
--------------
id:2
data$k: 1
id k b c
2 1 1 6
----------------
data$k: 2
id k b c
2 2 5 10

And I want is:

id k b c
1 1 1 3
1 2 1 4
2 1 1 6
2 2 5 10

Thank you!

like image 945
ShrestR Avatar asked Dec 20 '22 23:12

ShrestR


1 Answers

You can use do.call(rbind,data) for that

Alternative:

library(plyr)
ldply(data)
like image 141
Metrics Avatar answered Jan 17 '23 17:01

Metrics