Displaying 2 results from an estimated 2 matches for "yapply".
Did you mean:
apply
2013 Mar 07
2
iterative extracting data from a list without keys
...a way to do this. I have searched archives and find plenty of examples of extracting data elements individually, and even extraction of multiple vector elements (unfortunately one of mine is an matrix), but not my situation. In particular, no examples attempting to vectorize the math operation. yapply and mapply don't seem to be what I want, but what I've read of them confuses me. Want to avoid for loops, unless its the only way.
All help is much appreciated!
Thanks.
*******************************************************************
Jeff P. Hollenbeck
USGS Forest and Rangeland Ecosy...
2007 Jun 24
2
matlab/gauss code in R
...no way for lapply() to find out whether FUN will accept an argument INDEX
> without an "unused argument(s)" error, so it can't just be passed as an
> argument. This suggests having yet another apply function, that would
> assume an INDEX argument and might be written
> yapply<-function(X,FUN, ...) {
> index<-seq(length.out=length(X))
> mapply(FUN,X,INDEX=index,MoreArgs=list(...))
> }
>
> However, I think it would be preferable in many cases for INDEX to be
> names(X) if it exists, rather than 1:n. In any case, it is easy t...