Learn R Programming

admiral (version 1.1.1)

yn_to_numeric: Map "Y" and "N" to Numeric Values

Description

Map "Y" and "N" to numeric values.

Usage

yn_to_numeric(arg)

Value

1 if arg equals "Y", 0 if arg equals "N", NA_real_ otherwise

Arguments

arg

Character vector

See Also

Utilities for Formatting Observations: convert_blanks_to_na(), convert_na_to_blanks()

Examples

Run this code

yn_to_numeric(c("Y", "N", NA_character_))

Run the code above in your browser using DataLab