Thank you. You have been very helpful. I have managed to actually include all the asq variables to scale. I have been trying to alter your code so that the results are added to z.dat2, but haven't had any success. I’ve tried different variations of mutate_at and select(everything()) but nothing has worked. Any suggestions on what I am missing or not understanding?
z.dat2 <- dat %>%
as_tibble() %>%
filter(Groups != "other") %>%
select(ID, sex, ends_with("a"), everything()) %>%
gather(asq, value, -ID, -sex, -everything(), na.rm = TRUE) %>%
group_by(ID) %>%
mutate(z = as.vector(scale(value))) %>%
pivot_wider(names_from = asq, values_from = c(value, z))
#rstatsnewbie