[R] problem with outer and image
Ben Bolker
ben at zoo.ufl.edu
Tue Oct 5 15:37:18 CEST 1999
Ben Bolker bolker at zoo.ufl.edu
Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker
On Tue, 5 Oct 1999, Bill Simpson wrote:
> Thanks very much for any help.
Somebody'll probably answer this before I do -- but --
> time<-seq(1:100)
> f<-function(x,time) 10*cos(2*pi*x*3/length(x)+0)+300
> z<-outer(x,time,f)
> image(x,time,z)
> I get a vertical grating as expected, BUT now I get <1 cycle of cos
> wave. Varying the frequency (3 above) does nothing. I don't understand
> what I am doing wrong.
> f<-function(x,time) 10*cos(2*pi*x*3/length(x)+0)+300
^^^^^^^^^
here's the problem
The "x" that's getting passed to "outer" is not what you expect. If you
replace "length(x)" with 100 here, everything seems to do what you'd want.
>
> Bill
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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