3
I am operating a database with the following values:
data$Col_new <- data$Col_old
Col_Velha Col_Nova
Médico Médico
Médica Intensivista Médico
Técnica em Enfermagem Técnica em Enfermagem
Enfermeira Enfermeiro
To change the names I used the sub function with the following parameters
dados$Col_Nova <- sub(pattern = "[A-z]nfermeir[A-z].*", "Enfermeiro", dados3$Col_Nova)
dados$Col_Nova <- sub(pattern = "[A-z].{3}ic[A-z].*", "Médico", dados$Col_Nova)
However, when I’m trying to apply for nursing technician it’s not working, as follows the code:
dados$Col_Nova<- sub(pattern = "[A-z].{2}cnic[A-z]\\s.*", "Técnico de enfermagem", dados$Col_Nova)
What’s going on and why? Thank you!
In its place, I would try to adjust the encoding of reading that data. The old column at least is consistent: it looks like a given UTF-8 being treated as windows-1252.
– Ailton Andrade de Oliveira
How would I do that?
– Arduin
How you uploaded this data?
– Ailton Andrade de Oliveira
data <- read.csv(files[indice_files], header=T), where files is an array with the directory files and indice_files the name of the file I want to import.
– Arduin