[Solved] how to avoid repeated codes in R


I think you may want either of these two

new_table %>%
  group_by(sex, category, flag, day) %>%
  mutate(mean = mean(value),
         standardDeviation = sd(value))

or

new_table %>%
  group_by(sex, category, flag, day) %>%
  summarise(mean = mean(value),
         standardDeviation = sd(value))

1

solved how to avoid repeated codes in R