[Rd] bug in outer() (PR#755)

Thomas Lumley thomas@biostat.washington.edu
Fri, 1 Dec 2000 12:23:23 -0800 (PST)


On Fri, 1 Dec 2000 mvondavier@ets.org wrote:

> 
> sim3pl <- function(theta,i) {
> p2 <- p3pl(theta,i)
> p1 <- runif(1)
> temp <- response(p1,p2)
> return(p1)
> }
> 
> when calling outer(theta,items,sim3pl), where 
> 
> theta = rnorm(100,m,s)
> 
> and 
> 
> items = seq(1:nvar)
> 
> runif(1) is only called once (instead of 100*nvar times),
> even though if calling sim3pl manually, it is working ok.

It's not a bug. That's what's supposed to happen.

outer(a,b,f) calls f() once, with two very long vectors as arguments. It
only works on vectorised functions.


	-thomas

Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._