r - list variables to individual data.frames -


let's have list of 30 data.frames, each containing 2 variables (called value, , rank), called mylist

i'd know can use

my.df <- do.call("cbind", mylist) 

to create output my.df containing variables next each other.

it possible cbind each variable individually it's own data.frame i.e have new data.frame of 2nd variable?

we can extract second column looping on list (lapply) , wrap data.frame.

data.frame(lapply(mylist, `[`, 2)) 

if want separate variables,

lapply(names(mylist[[1]]), function(x)            do.call(cbind,lapply(mylist, `[`, x))) 

data

set.seed(24) mylist <- list( data.frame(value=1:6, rank= sample(6)),                  data.frame(value=7:12, rank=sample(6))) 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -