var_to_num: var_to_num Function

View source: R/var_to_num.R

var_to_numR Documentation

var_to_num Function

Description

The function var_to_num is used to convert a character variable to numeric variable. Change ',' by '.'. Delete spaces. Return a numeric variable and a warning with the delete values.

Usage

var_to_num(x, pat = NULL, rep = NULL)

Arguments

x

a character variable with numbers

pat

a string or strings with pattern to delete

rep

a string or strings witg pattern to replace

Value

a numeric variable and a warning with delete values. edad <- c("6", "6,7", "10 ", "12.5", "3 Hmisc::label(edad) <- "Edad de los pacientes" df <- data.frame(edad = edad, e1 = edad) df df

Author(s)

Miriam Mota miriam.mota@vhir.org


uebvhir/anaStatsUEB documentation built on May 6, 2023, 3:46 a.m.