I want to plot a curve that has a change point at x=5
Until now I am using the code
curve(exp(0.68+0.92*x), from=0,to=5, xlim=c(0,12), ylim=c(0,500))
curve(exp(0.68+0.92*x-0.7*(x-5)), from=5,to=12, add=T)
Is it possible to write it in one line (one curve
command)? I was thinking
something like this
curve(exp(0.47+0.8*x-0.7*(x-5)*if(x<5,0,1)), from=0,to=12, xlim=c(0,12), ylim=c(0,500))
but it doesn't work for R