safe_min: Calculate 'min' but suppress the warning when all values are...

View source: R/summarise.R

safe_minR Documentation

Calculate min but suppress the warning when all values are missing

Description

This function is a drop-in replacement for min, which is used in cat_summarise. It suppresses the warning when all values are NA and na.rm is TRUE, and returns NA instead of Inf.

Usage

safe_min(x, na.rm = FALSE)

Arguments

x

A numerical vector.

na.rm

A boolean indicating whether to remove NAs.

Value

The min of x or NA when values are missing.


olihawkins/tabbycat documentation built on Aug. 27, 2023, 10:15 a.m.