Re: [R] While loop history

2013-04-08 Thread C W
an using them. > > Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > > > > -----Original Message- > > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf > > Of C W > > Sent: Sunday, April 07, 2013 3:11 PM >

Re: [R] While loop history

2013-04-08 Thread MacQueen, Don
There are a number of different ways to do this, so it would have been helpful if you had set the context with a stripped down example. That said, here are some pointers: > x1 <- NULL > x1 <- c(x1,3) > x1 [1] 3 > x1 <- c(x1,4) > x1 [1] 3 4 So you see that you can add elements to the end of a vect

Re: [R] While loop history

2013-04-07 Thread William Dunlap
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of C W > Sent: Sunday, April 07, 2013 3:11 PM > To: John Kane > Cc: r-help@r-project.org; Baylee Smith > Subject: Re: [R] While loop history > > May I say also ask one thing?

Re: [R] While loop history

2013-04-07 Thread Jeff Newmiller
Vectors. Data frames are lists of vectors. Create longer vectors and perform computations vector-wise on all simulation data sets at once. Depending on the type of simulation, matrices and linear algebra may help as well. ---

Re: [R] While loop history

2013-04-07 Thread C W
May I say also ask one thing? @OP: sorry to use your post. What would you use instead of loops? I am aware of the apply() functions, but they are wrapper function of for loops, so they are slower. At one point, I was told to go back to C for faster implementation, but I like R much more. In th

Re: [R] While loop history

2013-04-07 Thread John Kane
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example 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 w