Ordinarily, I\'d use a pretty basic long-to-wide reshape for this, but it seems to be dropping my aggregation variables. The setup is I had a job on mechanical Turk that I perfo
Using plyr
:
res = ddply(dat,.(Input.id,Input.State),
function(x)unlist(as.character(x$Answer.Q1thing)))
setNames(res,c('Id','State','Answer1','Answer2','Answer3'))
Id State Answer1 Answer2 Answer3
1 134231 NY Myguess Myguess BadGuess
2 134812 CA Another Another Another
EDIT
In case you have fewer than 3 answers:
res = ddply(dat,.(Input.id,Input.State),
function(x)
{
xx= unlist(as.character(x$Answer.Q1thing))
if(length(xx)==3)xx
else c(xx,rep(NA,3-length(xx)))
})