[R] Vector loop

jim holtman jholtman at gmail.com
Tue Feb 5 21:34:12 CET 2008


Not too sure of exactly what you want to do with the loop.  Here is
one that prints out the values:

> x <- 1:10
> for (i in x) print(i)
[1] 1
[1] 2
[1] 3
[1] 4
[1] 5
[1] 6
[1] 7
[1] 8
[1] 9
[1] 10
>


On 2/5/08, mohamed nur anisah <nuranisah_mohamed at yahoo.com> wrote:
> hi,
>
>  I'm in my learning process of doing a programming with "for" loop. How to make a loop of a vector of length 10 where elements are 1,2,3,4,5,6,7,8,9,10. Any suggestion needed!! Many thanks.
>
>  Cheers,
>  Anisah
>
>
> ---------------------------------
>
>        [[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
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list