Hi, Try: datNew<- read.table(text=" activity max_dt A 2013-03-05 B 2013-03-28 A 2013-03-28 C 2013-03-28 B 2013-03-01 ",sep="",header=TRUE,stringsAsFactors=FALSE) datNew$max_dt<- as.Date(datNew$max_dt) aggregate(max_dt~activity,data=datNew,max) # activity max_dt #1 A 2013-03-28 #2 B 2013-03-28 #3 C 2013-03-28 #or
library(plyr) ddply(datNew,.(activity),summarize, max_dt=max(max_dt)) # activity max_dt #1 A 2013-03-28 #2 B 2013-03-28 #3 C 2013-03-28 #or ddply(datNew,.(activity),summarize, max_dt=tail(sort(max_dt),1)) # activity max_dt #1 A 2013-03-28 #2 B 2013-03-28 #3 C 2013-03-28 A.K. ----- Original Message ----- From: ramoss <ramine.mossad...@finra.org> To: r-help@r-project.org Cc: Sent: Thursday, May 23, 2013 10:23 AM Subject: [R] Removing rows w/ smaller value from data frame Hello, I have a column called max_date in my data frame and I only want to keep the bigger values for the same activity. How can I do that? data frame: activity max_dt A 2013-03-05 B 2013-03-28 A 2013-03-28 C 2013-03-28 B 2013-03-01 Thank you for your help -- View this message in context: http://r.789695.n4.nabble.com/Removing-rows-w-smaller-value-from-data-frame-tp4667816.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. ______________________________________________ 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.