***To ask this question I removed a Time column in my below example that exists in my actual data which featured the actual time (with different seconds despite same nominal time) which led to my data having one score per row. When I rounded these times I solved my problem using dcast :)
I am currently trying to tidy up my data and I'm running into some roadblocks (I'm a beginner to R and do most of my learning from this site). I want to transform my data to have symptoms shown in columns based both on matching the person and the nominal time of the symptom. Through this data tidying I will be reducing my data set of 64,000 observations to about 8,000. My data currently looks like this:
Person Nominal.Time Name Score
1 +30 A 6
1 +30 B 9
1 +30 C 3
2 +90 A 1
2 +90 B 5
2 +90 C 2
I was able to transform my data into the following:
library(reshape2)
WideSymptomData <- dcast(SymptomData,Person+Nominal.Time~Symptom.Name, value.var="Symptom.Score")
Person Nominal.Time A B C
1 +30 6
1 +30 9
1 +30 3
2 +90 1
2 +90 5
2 +90 2
But unfortunately I'm stumped at that point. I've been researching and can't seem to find out how to do the next step to ultimately reach this:
Person Nominal.Time A B C
1 +30 6 9 3
2 +90 1 5 2
I think this question might be similar to mine although I wasn't able to successfully apply the answers for it. Any guidance is much appreciated, thanks!