I\'m trying to convert some data from long to wide using the reshape2 package, but I\'m getting an error that I haven\'t been able to resolve. In the example below, I\'ve cr
Just put credits in quotation marks:
df.wide = dcast(df, ID ~ subj, value.var="credits", fun.aggregate=sum) df.wide ID CHEM ENGL HIST MATH 1 100 6 3 3 3 2 101 3 6 3 3 3 102 3 3 6 3 4 103 3 3 3 6