Re: [R] flag a record

2016-02-28 Thread Ashta
Thank you very much Jim! It is working fine!! On Sun, Feb 28, 2016 at 1:46 AM, Jim Lemon wrote: > Hi Ashta, > This does not seem too difficult: > > DF$flag<-"n" > for(thisname in unique(DF$Name)) { > if(any(DF$year[DF$Name == thisname] %in% c(2014,2015) & > DF$tag[DF$Name == thisname])) > DF

Re: [R] flag a record

2016-02-27 Thread Jim Lemon
Hi Ashta, This does not seem too difficult: DF$flag<-"n" for(thisname in unique(DF$Name)) { if(any(DF$year[DF$Name == thisname] %in% c(2014,2015) & DF$tag[DF$Name == thisname])) DF$flag[DF$Name == thisname]<-"y" } Jim On Sun, Feb 28, 2016 at 1:23 PM, Ashta wrote: > Hi all, > > I have a d

[R] flag a record

2016-02-27 Thread Ashta
Hi all, I have a data set represented by the following sample. I want flag records of an individual as "N", if if the tag column of an individual is equal to zero for the last two years. So in the following example, Alex1 records are flagged as "y", On the other hand Carla's records are fla