Skip to contents

When the function is invoked without specifying the column names to be converted, it automatically scans for columns containing exclusively missing, numeric, and character values. Furthermore, it identifies columns where the proportion of numeric values is at least twice the percentage of character values and performs the conversion in them.

Usage

convert_to_numeric(data, target_columns = NULL, lang = c("en", "fr", "es"))

Arguments

data

The input data frame or linelist

target_columns

A vector of the target column names. When the input data is a linelist object, this parameter can be set to linelist_tags if the tagged columns are those to be converted into numeric.

lang

The text's language. Currently one of "en" | "fr" | "es".

Value

A data frame after the conversion process, wherein all the specified or detected columns have been transformed into numeric format.

Examples

dat <- convert_to_numeric(
  data           = readRDS(system.file("extdata", "messy_data.RDS",
                                       package = "cleanepi")),
  target_columns = "age",
  lang           = "en"
)