Skip to contents

Maps specific frequency categories to numeric values, with error handling for invalid categories.

Usage

map_freq_to_numeric(df, colname)

Arguments

df

A data frame containing the column to be mapped.

colname

The name of the column to be mapped.

Value

A numeric vector with mapped values.

Examples

map_freq_to_numeric(data.frame(freq = c("Not at all", "Several days")), "freq")
#> [1] 0 1