On Sun, 7 Mar 2010 20:23:25 -0800 (PST) thedoctor81877 <thedoctor81877 @gmail.com> wrote: > Hello. I am new to R, and am typing some homework for my undergrad Analysis > class. I am trying to graph the following function in R: f(x) = x^2 for x > >=0, and f(x) = 0 for x <0. How do I do this in R?
f=function(x) ifelse(x >= 0, x^2, 0) curve(f, -2, 4) -- Karl Ove Hufthammer ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.