I have data in which each participant made 3 judgments for each of 9 objects (27 judgments). 9 objects changed in the 3x3 design (inside the objects), so there are 2 factors.
I start with ID + 27 data columns and I need to have
- ID
- 2 factor columns: performance, situation
- 3 columns of value: Success, ProbAdmit, Admit
I read the manuals on reseape () and melt () and cast (), but still could not figure out what I need to do to make this 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 the following:
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
Participant Performance Situation SuccessValue ProbAdmitValue AdmitValue
4001 GL IL 5.0 60 1
...
Thank!
source
share