[R] Question on graphs and simple if statements

JHawk3 Jhawk3 at ku.edu
Sun Sep 2 09:31:18 CEST 2007


Hi all,

I'm a relatively new user to the R interface, and am trying to do some basic
operations. So far I've used the curve() command to plot graphs. This has a
couple of limitations, namely trying to do piecewise graphs. Basically, I'm
looking for how to do "if" and "while" loops for making a graph.

in simple code, something like:

if x is on the interval [-1,1], x=x^2+1
otherwise, x=x^2

something along those lines. I also am wondering if it's possible to graph
something like this:
while(n<20)
{
curve(1/n^2, -1,1)
n++
}
Along these same lines, is there a way to graph finite series?

Thank you for your time and your replies.

-- 
View this message in context: http://www.nabble.com/Question-on-graphs-and-simple-if-statements-tf4366956.html#a12446999
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list