na_if_in: Replace values in x that are contained in y with NA.

View source: R/base.R

na_if_inR Documentation

Replace values in x that are contained in y with NA.

Description

This function is a variant/extension of dplyr::na_if(). Whereas that version requires y to be of length one, this function allows y to be a vector and replaces any elements of x that are found in y with NA values.

This function can be very useful when cleaning data and setting multiple any annoying values to NA.

Usage

na_if_in(x, y)

Arguments

x

Vector to modify.

y

Value to replace with NA.

Value

A modified version of x that replaces any values that are found in y with NA.

See Also

Other functions for NA handling: na_replace()


torfason/zulutils documentation built on Aug. 21, 2023, 5:46 p.m.