treatment of NULL in rbind.fill doesn't match rbind #138

Closed
ajdamico opened this Issue Mar 8, 2013 · 4 comments

Comments

Projects
None yet
3 participants

ajdamico commented Mar 8, 2013

not sure if this is intentional, possible improvement to rbind.fill()

library(plyr)

# works
rbind( NULL , mtcars )

# works
rbind.fill( data.frame() , mtcars )

# breaks
rbind.fill( NULL , mtcars )

otsaw commented May 17, 2013

This used to work at least in 1.7.1.

It seems that the fix to issue #51 is at fault.

Owner

hadley commented Jan 2, 2014

Do you have a real use case where this causes a problem?

otsaw commented Jan 3, 2014

Yes, I'd say so. Something like

dfs = lapply(...)
df = do.call(rbind.fill, dfs)

Depending on what the function under lapply does and what kinds of data it happens to have it's fully possible to get a NULL value instead of a zero-length data frame. And since at least unlist and rbind gracefully discard NULLs, I'm not used to trying to avoid them.

hadley closed this in bd8cba3 Jan 3, 2014

Owner

hadley commented Jan 3, 2014

Makes sense - now fixed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment