[R] ifelse statement

n.vialma at libero.it n.vialma at libero.it
Fri Sep 17 15:23:51 CEST 2010


Dear list,
I have a question I'm trying to use the following command in R, but it gives 
me an error message.The command is:

data<-ddply(data,c("year","name"), transform, check1=ifelse(check1==1 & 
check2==1, 1,NULL))

so in my data frame I already have the check1 variable, if the conditions 
(check1==1 & check2==1) is respected, check has to have 1 as value, whereas if 
it is not I want that variable to maintain its value.
Anyone knows, how to do this, by doing this for name and year??



More information about the R-help mailing list