search for: reclycles

Displaying 1 result from an estimated 1 matches for "reclycles".

2012 Jan 11
3
turning a list of vectors into a data.frame (as rows of the DF)?
...h.  I would like NAs as placeholders for "missing" data in the shorter vectors.  I think I'm missing something quite basic.   v1 <- c(1,2,3,4) v2 <- c(1,2) lst1 <- list(v1,v2)   Of course there is the intuitive:   as.data.frame(lst1)   However, the recycling rule (expectedly) reclycles 1,2 versus using NAs as placeholders.   Then, looking into Teetor's R Cookbook, there is a piece of code that looked (from the description) like it might do the trick:   do.call(rbind, Map(as.data.frame,lst1)   But I get the error: Error in match.names(clabs, names(xi)) :   names do not match...