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??
Hi, Not sure since I've never done it, but shouldn't it be NA instead of NULL? Ivan Le 9/17/2010 15:23, n.vialma@libero.it a écrit :> 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?? > > ______________________________________________ > R-help@r-project.org mailing list > stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Ivan CALANDRA PhD Student University of Hamburg Biozentrum Grindel und Zoologisches Museum Abt. Säugetiere Martin-Luther-King-Platz 3 D-20146 Hamburg, GERMANY +49(0)40 42838 6231 ivan.calandra@uni-hamburg.de ********** for771.uni-bonn.de webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php [[alternative HTML version deleted]]
Maybe Matching Threads
- data frame manipulation - splitting monitoring interval and assigning stage
- an error about " return some vectors from some functions within a function"
- save in for loop
- number of items to replace is not a multiple of replacement length
- [RFC][FileCheck] New option to negate check patterns