Re: [R] replace funcion

2012-08-11 Thread David L Carlson
]<-"invierno" >  df1$colA[df1$colA%in%numbers2]<-"verano" >  head(df1,10) > colA > 1  27 > 2  38 > 3  58 > 4  91 > 5  21 > 6  90 > 7  95 > 8  67 > 9  63 > 10 verano > > A.K. > >

Re: [R] replace funcion

2012-08-11 Thread arun
38 3  58 4  91 5  21 6  90 7  95 8  67 9  63 10 verano A.K. - Original Message - From: Dominic Roye To: r-help@r-project.org Cc: Sent: Saturday, August 11, 2012 3:10 PM Subject: [R] replace funcion Hello everybody, I would like to replace or recode a list

Re: [R] replace funcion

2012-08-11 Thread arun
frame(colA=sample(1:100,n,replace=TRUE)) within(df1,{colA[colA%in%numbers1]<-"invierno";colA[colA%in%numbers2]<-"verano"}) A.K. - Original Message - From: Dominic Roye To: r-help@r-project.org Cc: Sent: Saturday, August 11, 2012 3:10 PM Subject: [R] replace

Re: [R] replace funcion

2012-08-11 Thread Rui Barradas
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

[R] replace funcion

2012-08-11 Thread Dominic Roye
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='in