Code to calculate fraction of values outside of specified limits and the associated 'stoplight color' associated with that fraction; NAs can either be treated as errors or ignored.
Example usage for some test data:
test %>%
group_by(plot) %>%
summarise(flag_sensors(values, limits = c(3,7)))
produces
plot fraction_out color
<int> <dbl> <chr>
1 1 0.5 red
2 2 0.1 yellow
3 3 0 green
You can source the new flag_sensors.R file to run examples. Feedback welcome!
Code to calculate fraction of values outside of specified limits and the associated 'stoplight color' associated with that fraction; NAs can either be treated as errors or ignored.
Example usage for some test data:
produces
You can
source
the newflag_sensors.R
file to run examples. Feedback welcome!