I would like to make a loop to find only TRUE values. I have columns: name, parameter, value. I have 9 different values connected with one Name and different parameters connected with parameter column. First I need to group by name and parameter, find mean and sd and use the expression (it is imaginery expression below, maybe bot the correct one) to see is it meets the criteria (TRUE OR FALSE). Then I need to drop out all the FALSE values and do everything again (grouping by name and parameter, find mean and sd and use the expression) until there is no FALSE value in the column.
How I should do that?
It is something for doing it once:
df <- df %>%
group_by(name, parameter) %>%
summarise_at(parameter, list(mean=mean, sd=sd), na.rm=TRUE) %>%
mutate(result=sd - mean < mean - 1.5*sd & mean - sd < sd + 1.5*mean) %>%
drop_na()
But I need to do it again until all the results are always TRUE. Thank you in advance