[R] more about outer
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Sun Sep 23 20:33:45 CEST 2001
Erich Neuwirth <erich.neuwirth at univie.ac.at> writes:
> thanks,
>
> your original code did not wortk for me,
> but the following version seems to work
>
>
> vectorize2 <- function(f)
> function(x, y,...)
> sapply(1:length(x), function(i)f(x[i],y[i],...))
>
...
> > vectorize2 <- function(f)
> > function(x, y,...)
> > sapply(seq, along=x, function(i)f(x[i],y[i],...))
Oops, yes. What I meant was
sapply(seq(along=x), function(i)f(x[i],y[i],...))
(There's a difference if length(x) == 0)
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list