[R] Simple question regarding domain restrictions/piecewise functions in R

2012-03-25 Thread chad.mills
I am a novice R user. I would like to be able to graph some simple piecewise functions/functions with domain restrictions in R, but I'm having trouble defining such functions. For example, I would like to define the following function: f(x)={x^2 if -1http://r.789695.n4.nabble.com/Simple-question

Re: [R] Simple question regarding domain restrictions/piecewise functions in R

2012-03-26 Thread chad.mills
Yes! Thanks. It was just the "NA" value instead of the "as.null" that does the trick. Correct code for the original piecewise I stated (for those who might be looking later) is: f <- function(x){ ifelse((-1 < x & x < 1),x^2,ifelse((2http://r.789695.n4.nabble.com/Simple-questio

[R] Plot of function seems to cut off near edge of domain

2012-03-26 Thread chad.mills
Hello helpful R folks, I am simply trying to graph a quarter circle centered at the origin in the first quadrant. When I set the xlim of the plot to the radius of the circle, the plot appears correct. However, I'd like to see a slight extension of the axes beyond the domain of the function itself