Re: [R] Plotting a function that includes logical operators

2011-07-27 Thread dean123
Hi David, I am trying to define t as a single numeric value and not as a vector.. I want the function to realise that if I call test(t) and t is less than equal 10 return zero, if t greater than 10 return 2*t. Am i missing some code in which to define t a numeric value instead of a vector? Also,

[R] Plotting a function that includes logical operators

2011-07-27 Thread dean123
I am trying to plot the following function over the range 0-100 test <- function(t){{ if (t<=10) x<-t*0 else x<-2*t } x } when I use plot(test,0,100) the GUI produces the following; "Warning message: In if (t <= 10) x <- t * 0 else x <- 2 * t : the condition has length > 1 and only the first e