vendredi 4 mars 2016

Assigning value in R using if condition

I wish to assign value to a variable Value[1] using the following if condition. B123 is value that exists in dataframe Hello under column "Code"

IF(B123>10000,C456*D567,0)

Value[1]<-ifelse(Hello$Code[Hello$Code=='B123']>10000, Hello$Code[Hello$Code==C456]*Hello$Code[Hello$Code==D567],0)

This does not work

Aucun commentaire:

Enregistrer un commentaire