Displaying 1 result from an estimated 1 matches for "score3".
Did you mean:
scores
2010 Feb 25
2
Restructure some data
...dat <- data.frame(id = c(1,2,3,4,5), first.item = sample(item.pool, 5, replace=TRUE),
second.item = sample(item.pool, 5,replace=TRUE), third.item = sample(item.pool, 5,replace=TRUE),
score1 = sample(c(0,1), 5,replace=TRUE), score2 = sample(c(0,1), 5,replace=TRUE), score3 = sample(c(0,1), 5,replace=TRUE))
I need to restructure this into a new format. The new matrix df (after the loop) is exactly what I want in the end. But, I'm annoyed at myself for not thinking of a more efficient way to restructure this without using a loop.
df <- matrix(NA, ncol = length...