[R] defining a function by branches
Pedro Rodrigues de Almeida
pmrdealmeida at mac.com
Thu Oct 14 22:24:40 CEST 2004
Hi there,
How can I plot a function in R which is defined by conditional
branches?, e.g.:
u(x) = 1, Ed<x<2Ed (where Ed is a positive constant, say, 25);
u(x)=0.5*x, x>2Ed
curve(u(x), ....)
So far I have had to use curve(..., add=TRUE) with two function define
by segments, i.e., two branches or intervals for the variable x, say,
25,50 and then from 50,... and I would appreciate a more elegant
solution if possible.
Thanks a lot,
Pedro Rodrigues de Almeida
Helsinki - Finland
More information about the R-help
mailing list