Hello,

Try the following, using index vectors, not recode().

inx <- datos.mx1[, 7] %in% 5:10
datos.mx1[inx, 7] <- "verano"
datos.mx1[!inx, 7] <- "invierno"

Hope this helps,

Rui Barradas

Em 11-08-2012 20:10, Dominic Roye escreveu:
Hello everybody,


I would like to replace or recode a list of numbers between 1 and 12 (total
100). I have tried to make it with recode, but i have two types of
replacements. For 1,2,3,4,11,12 => invierno and for 5,6,7,8,9 and 10 =>
verano.

recode(datos.mx1[,7], "1='invierno'; 2='invierno';
3='invierno';4='invierno';11='invierno';12='invierno'")  #with this command
it works perfectly, but i have only one part

recode(datos.mx1[,7], "'5'='verano'; '6'='verano';
'7'='verano';'8'='verano';'9'='verano';'10'='verano'") #when i run this
command it works also fine, but it clears the first change above.

I had previously tried it with the if-command, but it doesn't work. I hope
someone can help me. Thank you very much.

Domi

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to