I have a data frame in R that looks like this
head(df)
Scoresheet.Id Entry.Number Round Judge.Name Judge.Initials Raw.Score
1 264372 608 2 Allen ag 79
2 266552 2493 2 Allen ag 67
3 265218 1996 1 Allen ag 65
4 266554 2751 2 Allen ag 64
5 266551 2399 2 Allen ag 63
6 262825 113 1 Allen ag 62
Obviously there's many more judges.
I'm trying to create a new column in the dataframe with a Z-score. I'm able to calculate the Z-score based on each judge's raw scores using.
with(df, tapply(as.numeric(df$Raw.Score), df$Judge.Name, scale))
That yields an array.
How can I put the resulting Z-scores in a new column in the dataframe?