nums_to_NA {eHDPrep}R Documentation

Replace numeric values in numeric columns with NA

Description

Replaces specified numbers in numeric columns with NA.

Usage

nums_to_NA(data, ..., nums_to_replace = NULL)

Arguments

data

A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr).

...

<tidy-select> One or more unquoted expressions separated by commas. Variable names can be used as if they were positions in the data frame, so expressions like x:y can be used to select a range of variables.

nums_to_replace

numeric vector of values to be replaced with NA. Case is ignored.

Details

Columns to process can be specified in ... or the function will be applied to all numeric columns.

Value

data with specified values replaced with NA

Examples

data(example_data)

# replace all 1,2, and 3 from tumoursize and patient_id with NA.
nums_to_NA(data = example_data, tumoursize, patient_id, nums_to_replace = c(1,2,3))

[Package eHDPrep version 1.3.3 Index]