This answer raised the question of how the ellipsis function in Rprocesses empty arguments. Apparently, an empty argument in ...works sometimes (see lapplyversion below), but not at other times (see sapplyversion). Here is an example:
lst <- list(x=matrix(1))
lapply(lst, "[", 1, )
sapply(lst, "[", 1, )
From what I can tell, it sapplyactually just reuses arguments ...when called lapply. So I don’t understand why it lapplyworks, but sapplyno. Can anyone explain this behavior.
The certificate sapplystates that
sapply (*, simplify = FALSE, USE.NAMES = FALSE) is equivalent to lapply (*).
However, I get the same results as above for the following:
lapply(lst, "[", i=1, j=)
sapply(lst, "[", i=1, j=, simplify=FALSE, USE.NAMES=FALSE)
, , TRUE , , , . , lapply, , sapply.