rbind
is generic, but it has no rbind.default
method that appears when you type:
methods(rbind)
Instead, when you type rbind
at the console you will see:
function (..., deparse.level = 1)
.Internal(rbind(deparse.level, ...))
<bytecode: 0x100e55f20>
<environment: namespace:base>
So it is not correct that rbind
is only implemented for dataframes in pkg:base. Instead there will be a call to .Internal(rbind(deparse.level, ...)
. The logic of the .Internal(rbind(..))
function then supplants the usual S3 logic so it can check whether any of the items in the argument list are data.frames. If not then it continues on to process atomic vectors and matrices. For example on my machine at the moment I see 4 methods listed:
methods(rbind)
[1] rbind.data.frame rbind.matrix.csr rbind.Predict*
[4] rbind.zoo*
It is also imprecise to say rbind.data.frame
only applies to dataframes. More precise would be to use the language in the second sentence of Details section of ?rbind
. And to actually read the rest of the help page which Joshua has now reminded us all to read.
The lack of an rbind.default
is a departure from the usual method of handling S3 generic functions. Most S3-generics that I have examined have had *.default
methods. Some, like plot.default
even have their own help pages.
And finally, I have no clue why the rownames appear the way they do in the original question.