Skip to main content
4 events
when toggle format what by license comment
Jan 23, 2012 at 21:48 vote accept ftonti
Jan 23, 2012 at 21:29 comment added Justin Yeah, copied the wrong line. to answer, use ?melt dat<-data.frame(userid=1:100,q1=sample(letters[1:4],100,replace=T),q2=sample(letters[1:4],100,replace=T)) dat.melt<-melt(dat,id.var='userid')
Jan 23, 2012 at 21:19 comment added ftonti Thank you! I think that line should be dat<-data.frame(answer=sample(letters[1:4],1000,replace=T),question=rep(c('q1','q2','q3','q4'),each=250)) This example is very helpful. Just another stupid question: I have a data frame where each column has the name of a question and the entries are the answers given to that question listed by users (the user id's are the first column of the data frame). How do I get this data frame in something like the thing you generated? Thank you very much!
Jan 23, 2012 at 21:03 history answered Justin CC BY-SA 3.0