Skip to contents

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()