Skip to content
Prev 374435 / 398513 Next

Converting a list to a data frame

If you require that the 'type' column be a factor with a level for each
element of the input list, then you need to do that after calling
dplyr::bind_rows(), just as with the base-R solutions.
Y=integer()), C = data.frame(X=3L, Y=13L) )
'data.frame':   3 obs. of  3 variables:
 $ Which: chr  "A" "A" "C"
 $ X    : int  1 2 3
 $ Y    : int  11 12 13
'data.frame':   3 obs. of  3 variables:
 $ Which: Factor w/ 3 levels "A","B","C": 1 1 3
 $ X    : int  1 2 3
 $ Y    : int  11 12 13

Sometimes you need the names of the of the 0-row data.frames in the output
to make plots, etc., comparable across various samples of the data.


Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, May 3, 2018 at 10:28 AM, Hadley Wickham <h.wickham at gmail.com> wrote: