Re: [R] A strange behaviour in the graphical function "curve"

2013-04-12 Thread David Winsemius
On Apr 12, 2013, at 7:58 AM, Julio Sergio wrote: Berend Hasselman xs4all.nl> writes: Your function miBeta returns a scalar when the argument mu is a vector. Use Vectorize to vectorize it. Like this VmiBeta <- Vectorize(miBeta,vectorize.args=c("mu")) VmiBeta(c(420,440)) and draw the c

Re: [R] A strange behaviour in the graphical function "curve"

2013-04-12 Thread Jeff Newmiller
See below On Fri, 12 Apr 2013, Julio Sergio wrote: Berend Hasselman xs4all.nl> writes: Your function miBeta returns a scalar when the argument mu is a vector. Use Vectorize to vectorize it. Like this VmiBeta <- Vectorize(miBeta,vectorize.args=c("mu")) VmiBeta(c(420,440)) and draw the

Re: [R] A strange behaviour in the graphical function "curve"

2013-04-12 Thread Julio Sergio
Berend Hasselman xs4all.nl> writes: > > Your function miBeta returns a scalar when the argument mu is a vector. > Use Vectorize to vectorize it. Like this > > VmiBeta <- Vectorize(miBeta,vectorize.args=c("mu")) > VmiBeta(c(420,440)) > > and draw the curve with this > > curve(VmiBeta,xli

Re: [R] A strange behaviour in the graphical function "curve"

2013-04-12 Thread Julio Sergio
Berend Hasselman xs4all.nl> writes: > > Yes. curve expects the function you give it to return a vector if the input argument is a vector. > This is clearly documented for the argument "expr" of curve. Thanks a lot, Berend! In fact, I didn't read carefully the documentation of "curve". Anyway

Re: [R] A strange behaviour in the graphical function "curve"

2013-04-11 Thread Berend Hasselman
On 12-04-2013, at 05:15, Julio Sergio wrote: > I thought the curve function was a very flexible way to draw functions. So I > could plot funtions like the following: > > # I created a function to produce functions, for instance: > fp <- function(m,b) function(x) sin(x) + m*x + b > # So I

[R] A strange behaviour in the graphical function "curve"

2013-04-11 Thread Julio Sergio
I thought the curve function was a very flexible way to draw functions. So I could plot funtions like the following: # I created a function to produce functions, for instance: fp <- function(m,b) function(x) sin(x) + m*x + b # So I can produce a function like this ff <- fp(-0.08, 0.2)