[R] While loop history

John Kane jrkrideau at inbox.com
Sun Apr 7 13:43:00 CEST 2013


Loops are seldom a good solution in R so some more information and data would be useful

At the simplist, for your specific question  I think you could set up two vectors (e.g. v1  <-  rep(NA, 10 ) and just write the values into the vectors as you proceed through the loop.

John Kane
Kingston ON Canada

> -----Original Message-----
> From: bayywater at gmail.com
> Sent: Sun, 7 Apr 2013 14:36:33 +1200
> To: r-help at r-project.org
> Subject: [R] While loop history
> Hi,
> I am new at R and still trying to get the hang of things.
> I am running a while loop and wish to save the results of each iteration.
> The results are a vector x of length two and I wish to save the results
> of
> each iteration as two vectors, one for x[1] and the other for x[2].
> Thanks!
> 	[[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.

GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails

More information about the R-help mailing list