eglist <- list(BB=c(6,9,2,6), KA=1:8, JE=c(-3,2) )
eglist
l2df(eglist) # names are even kept
l2df(eglist, byrow=FALSE)
class( l2df(eglist, byrow=FALSE) ) # data.frame (since 2016-05-24)
eglist <- list(BB=c(6,9,2,6), KA="no", JE=c(-3,2) )
eglist
l2df(eglist) # now everything is a character
eg2 <- list(BB=c(6,9,2,6), KA=matrix(1:8, ncol=2), JE=c(-3,2) )
eg2
l2df(eg2, FALSE)
# so a matrix is internally converted to a vector and then used regularly
eg2 <- list(BB=c(6,9,2,6), KA=data.frame(SW=1:8, SB=4:-3), JE=c(-3,2) )
eg2
is.error( l2df(eg2) )# it is not possible to do this with a data.frame
# If you have a list with only data.frames, you could use the following:
eg3 <- list(KA=data.frame(SW=1:8, SB=4:-3), LS=data.frame(BB=23:24, JE=c(-3,2)))
eg3
do.call(cbind, eg3) # but this recycles the values of shorter tables!
# check some of the links above if you really have this problem...
Run the code above in your browser using DataLab