var_to_num | R Documentation |
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.
var_to_num(x, pat = NULL, rep = NULL)
x |
a character variable with numbers |
pat |
a string or strings with pattern to delete |
rep |
a string or strings witg pattern to replace |
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
Miriam Mota miriam.mota@vhir.org
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.