On Mon, 2004-02-02 at 13:42, Catherine Stein wrote:
> Hello R people!
> 
> How can one use a for loop (or something similar) in R?  As I type in each
> line, I get syntax errors... I'm just confused how much to type in at each
> ">" prompt.
> 
> Thanks for your help,
> cathy

Hello.

I believe you want something like:

for(i in 1:n){
...some lines here...
}

If you have only one line within the for loop you can use it without the
brackets.

If the environment is still open (as within the for loop) you will not
get a new ">" prompt but a "+" prompt to continue as if you were writing
on the same line.

Only when you close the brackets the prompt will return to ">" after
executing the for loop.

Hope this will help.

Pedro

-- 
-----------------------------------------------------------
   Pedro Pereira Rodrigues
   http://www.dcc.fc.up.pt/~prodrigues/

   Phone: +351 226078830 - Ext: 121
   Snail: Department of Computer Science
          Faculty of Sciences - University of Porto
          Rua do Campo Alegre, 823
          4150-180 Porto - Portugal

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to