Skip to contents

This function recodes given values to NA (missing) in given variables of a data.frame.

Usage

recode_values_to_NA(df, vars, values)

Arguments

df

data.frame

vars

(character) vector of variable names

values

(vector) values to replace with NA

Value

df with values in vars replaced with NA

Examples

df <- df |> recode_values_to_NA(vars="x"%p%1:3, values=0)
#> [1] "Replaced these values in variables with NA:"
#> $Variables
#> [1] "x1" "x2" "x3"
#> 
#> $Values
#> [1] 0
#>