Re: [R] Unexpected output in first iteration of for-loop

2010-02-11 Thread Chaehan So
Don, that was great - thanks so much! ...and you are right rbind() being expensive, but my dataframe will always stay that small (max. twice as large). Chaehan On Thu, Feb 11, 2010 at 4:50 PM, Don MacQueen wrote: > You have a mistake in how you're setting up the object named "result" > before t

Re: [R] Unexpected output in first iteration of for-loop

2010-02-11 Thread Don MacQueen
You have a mistake in how you're setting up the object named "result" before the loop. You set result <- latentVariableNames. It is a vector of length 6, when you call the function with LV. The printout from the first iteration shows this. But then you rbind result with a data frame that has

Re: [R] Unexpected output in first iteration of for-loop

2010-02-11 Thread Chaehan So
Ok, you're right - may I rephrase: How should I modify the assignment of result <- latentVariableNames so it produces the output without the first line? I thought result <- NULL should do the job, but it didn't because of the following names(result) assignment (which I understand, but not how I ca

Re: [R] Unexpected output in first iteration of for-loop

2010-02-10 Thread jim holtman
It doing exactly what you asked it to do. You have the assignment: result <- latentVariableNames and then you print it out in the loop. What were you expecting? On Wed, Feb 10, 2010 at 9:06 PM, Chaehan So wrote: > Dear r-helpers, > > why do I get an output in the first iteration of the for-lo

[R] Unexpected output in first iteration of for-loop

2010-02-10 Thread Chaehan So
Dear r-helpers, why do I get an output in the first iteration of the for-loop which contains the string values of the input vector, and how can I avoid that? Here's the output (only line 1 is wrong) latentVariable Indiv Group 1 rPlanning rIterat rTDD 2 rPlanning0.79 0.84 3