r - do.call vs rbind, keeping rownames -


when using rbind vs do.call(rbind, x). why , how do.call operation maintain parent list names , not rbind?

also, if replicate behaviour of do.call within rbind, retrieving parent list name , pass along row-name, how done smooth possible?

consider named list:

(l <- list(a=data.frame(x=1, y=2), b=data.frame(x=2, y=3))) # $a #   x y # 1 1 2 #  # $b #   x y # 1 2 3 

as note, do.call rbind passes names of list elements, results in row names combined data frame:

do.call(rbind, l) #   x y # 1 2 # b 2 3 

to these names using rbind alone, need provide named arguments function:

rbind(a=l[["a"]], b=l[["b"]]) #   x y # 1 2 # b 2 3 

Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -