Does anyone know how to keep rownames in the rbind.fill
function.
library(plyr)
#creating data
a <- mtcars[ 1:5 , c("mpg","hp","gear") ]
b <- mtcars[ 6:10 , c("mpg","disp","gear") ]
#does not work because there are different colnames
rbind(a,b)
#works but eliminates the rownames
bound <- rbind.fill( a , b )
I am setting up a loop where objects will be connected using rbind.fill
. Right now I am using the combine function like this:
namess <- c( rownames(a) , rownames(b) )
rownames(bound) <- namess
I thought that there might be a better way. Thanks!