[R] for loop

jim holtman jholtman at gmail.com
Mon Feb 13 19:38:06 CET 2012


x <- 29.5 + (1:1000)/500
y <- 2 * x
plot(y,x)

On Mon, Feb 13, 2012 at 1:34 PM, eddie smith <eddieatr at gmail.com> wrote:
> Hi guys,
>
> This is a very beginner question. Anybody willing to help?
>
> for(i in 1:1000)
> x=29.5 + i/500
> y=2x
> plot(y,x)
>
> The idea is to produce 1000 values of x and y then plot them.
>
> Cheers,
> Eddie
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.



More information about the R-help mailing list