I have a column in a dataframe and I would like to filter out any rows that are over or under two standard deviations from the mean.
As an example, I would hope to get two rows out of this (only the rows that fall between the low and high standard deviations:
group value low_sd high_sd
a 4 2 8
a 1 2 8
b 6 4 9
b 12 4 9
I was hoping to use dplyr::between .
clean_df <- df%>%
filter(between(value, low_sd, high_sd))
But it seems between only takes numerical values.