Re: [R] VisualBasic "select case" commad in R

2011-08-31 Thread Antonio Silva
Thanks Jorge and Michael "recode" was exactly what I was looking for. AG<-2.7 VAR<-recode(as.integer(AG),"c(0,5,8,10)=37;c(1,4)=70;c(3,6,9)=90;c(2,7)=112") VAR [1] 112 Great! All the best, Antônio 2011/8/31 Jorge I Velez > Hi Antonio, > > Take a look at > > require(car) > ?recode > > for an

Re: [R] VisualBasic "select case" commad in R

2011-08-31 Thread Jorge I Velez
Hi Antonio, Take a look at require(car) ?recode for an alternative. HTH, Jorge On Wed, Aug 31, 2011 at 1:27 PM, Antonio Silva <> wrote: > Hello > > I'm translating a Visual Basic routine to R. > > Which command in R is similar to "select case" in VB? > > See the example: > > select case int(

Re: [R] VisualBasic "select case" commad in R

2011-08-31 Thread R. Michael Weylandt
? switch Might do the job. On Wed, Aug 31, 2011 at 1:27 PM, Antonio Silva wrote: > Hello > > I'm translating a Visual Basic routine to R. > > Which command in R is similar to "select case" in VB? > > See the example: > > select case int(AG) > case 0, 5, 8, 10 > VAR = 37 > case 1, 4 > VAR = 7

[R] VisualBasic "select case" commad in R

2011-08-31 Thread Antonio Silva
Hello I'm translating a Visual Basic routine to R. Which command in R is similar to "select case" in VB? See the example: select case int(AG) case 0, 5, 8, 10 VAR = 37 case 1, 4 VAR = 70 case 3, 6, 9 VAR = 90 case 2, 7 VAR = 112 end select A chain of "if else" would not be very ele