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
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(
? 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
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
4 matches
Mail list logo