I am trying to Z-score a certain part of the data set here.
I have a table like this: Called DF
Participant | Date | XPL | WAYS | SPM |
---|---|---|---|---|
Location | TBD | 12 | 3 | 5.5 |
George | 10_Sep_Mon | 23 | 12 | 12.7 |
Sam | 10_Sep_Mon | 14 | 2.5 | 5 |
Carl | 10_Sep_Mon | 21 | 2.8 | 5.1 |
I only want to apply an operation on the second row, starting on George, and just the section between XPL, WAYS and SPM. I do not want to do any calculation on the first row.
Participant | Date | XPL | WAYS | SPM |
---|---|---|---|---|
Location | TBD | 12 | 3 | 5.5 |
George | 10_Sep_Mon | 23 | 12 | 12.7 |
Sam | 10_Sep_Mon | 14 | 2.5 | 5 |
Carl | 10_Sep_Mon | 21 | 2.8 | 5.1 |
The end result, I want to Z-score the bolded numbers so for example, each column will be z-scored, except the first column. What is the best way to do this for a large data set with a lot of columns?
I know there is a scale() command, but is this applicable for z-scores? And if so, how can it be used here? Z-score is also the score minus the mean, all divided by standard deviation, so I am trying to see how to code this all.
Any help would be greatly appreciated! Thank you.
Participant <- c("Location", "George", "Sam", "Carl")
Date <- c("TBD", "10_Sep_Mon", "10_Sep_Mon", "10_Sep_Mon")
XPL <- c(12, 23, 14, 21)
WAYS <- c(3, 12, 2.5, 2.8)
SPM <- c(5.5, 12.7, 5, 5.1)
DF <- data.frame(Participant, Date, XPL, WAYS, SPM)