Re: [R] function corresponding to map of perl

From: Roger D. Peng <rpeng_at_jhsph.edu>
Date: Fri 15 Apr 2005 - 23:22:40 EST

I think you want 'sapply()'.

-roger

Wolfram Fischer wrote:
> Is there a function in R that corresponds to the
> function ``map'' of perl?
>
> It could be called like:
> vector.a <- map( vector.b, FUN, args.for.FUN )
>
> It should execute for each element ele.b of vector.b:
> FUN( vector.b, args.for.FUN)
>
> It should return a vector (or data.frame) of the results
> of the calls of FUN.
>
> It nearly works using:
> apply( data.frame( vector.b ), 1, FUN, args.for.FUN )
> But when FUN is called ele.b from vector.b is no known.
>
> Thanks - Wolfram
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sat Apr 16 00:10:09 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:11 EST