Learn R Programming

tabbycat (version 0.18.0)

safe_min: 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)

Value

The min of x or NA when values are missing.

Arguments

x

A numerical vector.

na.rm

A boolean indicating whether to remove NAs.