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

symfony - InvalidConfigurationException in SecurityExtension.php line 429: No authentication listener registered for firewall "secured_area" -

angular ui router - 10 digest iterations reached in angularjs when using $state.go -

javascript - Handling constructor related functions while testing with mocha and sinon -