COnsider the following: Age<-c(48, 57, 56, 76, 76, 66, 70, 14, 7, 3, 62, 62, 30, 10, 7, 53, 44, 29, 46, 47, 15, 13, 84, 77, 26)
SerialNo<-c(001147, 005979, 005979, 006128, 006128, 007004, 007004, 007004, 007004, 007004, 007438, 007438,009402,009402, 009402, 012693, 012693, 012693, 014063,014063, 014063, 014063, 014811, 014811,016570) TestSet<-cbind(Age,SerialNo) TestSet<-data.frame(TestSet) I am looking to create a third column titled "IsHead". This column would be either TRUE or FALSE depending on whether the Age variable was the greatest for that set of SerialNo's. So for the above i would return: Age SerialNo IsHead 48 1147 TRUE 57 5979 TRUE 56 5979 FALSE 76 6128 TRUE 76 6128 FALSE 66 7004 FALSE 70 7004 TRUE 14 7004 FALSE 7 7004 FALSE 3 7004 FALSE I am thinking this is simple but cannot get my own code to work. Thanks for any insights. JR -- View this message in context: http://www.nabble.com/Truncating-based-on-attribute-range-and-serial-no-tp24796313p24796313.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.