I have data in which each participant made 3 judgments on each of 9 objects (27 judgments). The 9 objects varied in a 3x3 design (within subjects) so there are 2 factors.
I'm starting with ID + 27 data columns, and I need to have
- ID
- 2 factor columns: Performance, Situation
- 3 value columns: Success, ProbAdmit, Admit
I have read the manuals on reshape() and melt() and cast() but haven't yet been able to figure out what I need to do to make it happen. Here is my current progress from which you can see my actual data.
scsc3 <- read.csv("http://swift.cbdr.cmu.edu/data/SCSC3-2006-10-10.csv")
library(reshape)
scsc3.long <- melt(scsc3,id="Participant")
scsc3.long <- cbind(scsc3.long,colsplit(scsc3.long$variable,split="[.]",names=c("Item","Candidate","Performance","Situation")))
scsc3.long$variable <- NULL
scsc3.long$Candidate <- NULL
The above code leaves me with this:
Participant value Item Performance Situation
4001 5.0 Success GL IL
4001 60 ProbAdmit GL IL
4001 1 Admit GL IL
4002 ....
What I need is a dataframe like this
Participant Performance Situation SuccessValue ProbAdmitValue AdmitValue
4001 GL IL 5.0 60 1
...
Thanks!