na_if_any: Convert values to NA

View source: R/na_if_string.R

na_if_anyR Documentation

Convert values to NA

Description

Convert values in x to NA if they match any elements of y.

Usage

na_if_any(x, y)

Arguments

x

Vector to modify.

y

Values to replace with NA.

Value

A modified version of x that replaces any values that are equal to any element of y with NA.

See Also

This is similar to dplyr::na_if() but checks each element of x for a match with any elements of y.

Examples

na_if_any(1:5, c(2, 4))

jedwards24/edwards documentation built on Sept. 2, 2023, 8:16 a.m.