Skip to content
Prev 60461 / 63424 Next

Bug in rbind.data.frame?

Okay, I spotted it.  This is intentional.  From ?rbind.data.frame:

"The rbind data frame method first drops all zero-column and zero-row 
arguments."

So I wouldn't expect to keep the names in the argument that was dropped.

However, there's still an issue in the case where the row is named.  To 
me it implies that when df is empty, rbind(df, c(a=1, b=2)) should be 
the same as rbind(c(a=1, b=2)), which gives a properly named result.  Of 
course, rbind(c(a=1, b=2)) won't call rbind.data.frame() at all, so that 
explains the difference, but not the intention.

Duncan Murdoch
On 30/01/2022 6:50 a.m., Duncan Murdoch wrote: