I'm struggling to get the following code working. The data I have is a data.frame of a physical test. Athletes who did the test are classified based on a 'Sport Specific' paramater.
wingate_benchmarks <- wingate_data %>%
select(`Sport Specific`,`Minimum power output`,`Average power output`,
`Relative Average Power`,`Peak Power`,`Time to peak`,`Max. RPM`,`Time to Max. RPM`,`Total Work`) %>%
group_by(`Sport Specific`) %>%
dplyr::summarize_at(vars(`Minimum power output`,`Average power output`,
`Relative Average Power`,`Peak Power`,`Time to peak`,`Max. RPM`,`Time to Max. RPM`,`Total Work`),
list(mean = mean, sd = sqrt((n()-1)/n())*sd))
If I use only sd, it calculates the Standard Deviation as if the data is a sample, but it should be considered as the full popluation. Hence the sqrt((n()-1)/n())
addition.
But R keeps returning: Error: n()
must only be used inside dplyr verbs.
Is there anyway to solve this? Thanks!