Displaying 1 result from an estimated 1 matches for "answer_78".
Did you mean:
answer_1
2006 Jul 24
1
Referring on the value of a counter in a loop
...on loops.
Suppose you have data (say, 1000 cases) with two variables named
"answer" (string) and "class" (numeric). The latter runs from 1 to 78
and categorizes the data. I need to create a file "answer_1.txt" for
the cases with class==1, and so on, up to "answer_78.txt"
I have been able to do this for one value of "class" in the following
way
k_1<-answer[class==1]
write.table(k_1, "answer_1.txt")
Now, I would like to loop over "class", replacing the occurences of
"1" in the code above successively with th...