[R] Trouble With for() Loops
Milo Phillips-Brown
mphillip at reed.edu
Wed Mar 3 08:27:27 CET 2010
Hello,
I'm trying to learn R (for fun!), and I've tried to find any previous
discussion of this problem (or something like it) and haven't found one.
When I run the following command, R seems to simply stop. I get no error
message, but I also have no ">" or "+" to type after (although I can
type). The only solution seems to be restarting the program. Here's the
code:
for(i in 1:150)
for(j in 1:150)
(average <-c(
(if(NO[i]==1)
{i*0}
else
{if(HA[i]==HA[j])
{while(G[j]==1)
{mean(PT[j:(i-1)])}}})))
Also, if what I'm trying to do makes any sense and someone sees an
easier way of doing it, that would be great.
Thanks!
Milo
Undergraduate -- Reed College
Portland, OR
More information about the R-help
mailing list