Re: [R] plot a function with a vector as argument

2008-05-18 Thread jim holtman
In the call to the function 'fr1', the argument 'x' comes in as a vector and you get a vector result. Here is what it looks like: > fr2(seq(0,1,.1)) [1] 1.00 1.31 1.64 1.99 2.36 2.75 3.16 3.59 4.04 4.51 5.00 because fr2 is sending a vector of length 10 to fr1 which will return a vector of lengt

[R] plot a function with a vector as argument

2008-05-18 Thread chaij
I tried to define a function using another function I defined before, and the previous function has a vector as an argument, when I tried to get the graph of the new function, there was something going wrong. Here is a simple example to explain how it happend: fr1 <- function(x,y){ x^2+x*y+1 }