I need to manipulate the raw data (csv) to a wide format so that I can analyze in R or SPSS.
It looks something like this:
1,age,30
1,race,black
1,scale_total,35
2,age,20
2,race,white
2,scale_total,99
Ideally it would look like:
ID,age,race,scale_total, etc
1, 30, black, 35
2, 20, white, 99
I added values to the top row of the raw data (ID, Question, Response) and tried the cast function but I believe this aggregated data instead of just transforming it:
data_mod <- cast(raw.data2, ID~Question, value="Response")
Aggregation requires fun.aggregate: length used as default