Dear Group, I am working with a large dataset where I need to select for each unique id the the unique lastpk row. Here is a sample subject:
id wtdt wt lastpk 64050256 2010-09-18 275 2010-09-16 64050256 2010-09-19 277 2010-09-18 64050256 2010-09-20 272 2010-09-18 64050256 2010-09-21 277 2010-09-18 I want the result as: id wtdt wt lastpk 64050256 2010-09-18 275 2010-09-16 64050256 2010-09-19 277 2010-09-18 I am using !(duplicated(data$id)) to select the first row but now I want to select the first row of the unique lastpk in each unique id. I appreciate your help on this. Regards, Ayyappa [[alternative HTML version deleted]] ______________________________________________ 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.