Displaying 1 result from an estimated 1 matches for "recursilv".
Did you mean:
recursiv
2008 Dec 11
2
is there a way to recursilvely lapply
for a simple example:
x <- list()
x[["a"]] <- list(a=c(1,2,3),b=c(3,4,5))
x[["b"]] <- list(a=c(6,7,8),b=c(9,10,11))
lapply(x,sum)
this fails w/
Error in FUN(X[[1L]], ...) : invalid 'type' (list) of argument
Just wondering if I have overlooked something obvious.
one can also do:
lapply(x,lapply,sum)
but that assumes that you already know how many levels