dataframe - Unused Argument Error in function during a do.call loop in R -


funmergea <- function(x,y = null) {     if (is.null(y)) {         return(x)     } else {         return(funmerge(x,y,"a"))     } }  funmerge <- function(x,y,myby="a") {     return(merge.data.frame(x,y,by=myby,all=true)) }  b <- list(data.frame(a=1:10,b=rnorm(10)),           data.frame(a=1:10,b=rnorm(10)),           data.frame(a=1:10,b=rnorm(10))) 

this works :

funmergea(funmergea(funmergea(b[[1]],null),b[[2]]),b[[3]]) 

this doesn't :

do.call(funmergea,b) 

i confused why second 1 doesn't work. understanding 2 expressions strictly equivalent. understanding flawed ?

all welcome !

do.call iterates through b 1 element @ time not recursive in way need be. need reduce(funmergea, b).


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -