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 am confused as to why the second one doesn't work. My understanding is that the 2 expressions are strictly equivalent. Is my understanding flawed ?
All help welcome !