Hello out there,
i am not yet that experienced and trying to my best on a real survey.
but i am stuck with a little matrix / vector problem.
my vector of answers could have a length of 3 or only one. i want to
rbind all the answers into one matrix. (one vector for each participant)
answers vectors for one participant could look like:
p1: 100
p2: 20 80
p3: 40 10 50
i have the following loop which should rbind them but i get no proper
matrix.
i´d like to have something like this
100 0 0
20 80 0
40 10 50
Here´s my loop:
for(s in 1:length(fr))
{
### ansmini is a complete survey of one participant
ansmini3=answers[relevant[s,],]
for(x in 1:length(qidsb3))
{
# outputs all answer ids out of all data which belong to the
qids
out of the question id vector
ansmin3=ansmini3[,1][ansmini3[,3]==qidsb3[x]]
newb3=rbind(newb3,ansmin3)
}
}
this is doing the job for question with only one answer, so i have
only one answer id.
in this new case i have 1-3 possible answers.. that´s why i´am not
getting a nice newb3 matrix...
i´d really be happy about some advice!
thanks in advance
matthias
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.