re_name: A re_name Function

View source: R/re_name.R

re_nameR Documentation

A re_name Function

Description

Renombra los identificadores de columna, substituyendo '.' por '_', eliminando acentos, ec.

Usage

re_name(data, char = NULL, newchar = NULL)

Arguments

char

a character string specifying the characters to be translated. If a character vector of length 2 or more is supplied, the first element is used with a warning.

newchar

a character string specifying the translations. If a character vector of length 2 or more is supplied, the first element is used with a warning.

dat

data frame que contiene las variables a evaluar or character vector with variable names.

Author(s)

Miriam Mota mmota.foix@gmail.com

Examples

df <- data.frame('nombre+a-apellido' = as.factor(rbinom(50,1,.40))
, 'dni...NIF' = rnorm(50,10,1),
'Y/X'=as.factor(rbinom(50,1,.40)),'ibm 2' = rnorm(50,10,1))
names(df) <- c('nombre+a-apellido',
'dni...NIF', 'Y/X', 'ibm 2') ## modifiquem noms per a que siguin "incorrectes"
df <- re_name(data = df)
df <- re_name(data = df, char = "+-", newchar = "__")

miriamMota/mmotaF documentation built on Jan. 12, 2023, 4 a.m.