Hello List,

I did this script to clear data after import (I don’t know is ok ). After
its execution levels and label values got lost. Could some explain me to
reassign levels again in the script (new depurate value)? 

Best regard

Maicel Monzon MD, PHD

Center of Cybernetic Apply to Medicine

# data cleaning  script

library(stringr)

for(i in 1:length(data)) { 

  if (is.factor(data[[i]])==T) 

  {for(j in 1:sum(str_detect(data[,i], "  "))) 

  {data[[i]]<-str_replace_all(data[[i]], "  ", " ")}}

  data[[i]]<-str_trim (data[[i]],side = "both")

  data[[i]]<-tolower(data[[i]])

}

Note: “   ” is 2 blank space  and “ “  only one

 



--
Nunca digas nunca, di mejor: gracias, permiso, disculpe.

Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/




	[[alternative HTML version deleted]]

