[R] Odp: Subsetting subsets of data.frames
petr.pikal at precheza.cz
Mon Jun 7 14:33:44 CEST 2010
some example would be helpful.
r-help-bounces at r-project.org napsal dne 07.06.2010 09:01:27:
> Hey Everyone,
> I have been stumped by this all day.
> Basically, I have a data.frame of multiple columns. Of concern are "id"
> For some reason, oftentimes there are duplicates of data with the same
> I would like to remove the duplicates per different id (removing
> dates for the entire data.frame would leave nothing since different id's
> have the same dates)
> subset(x,!duplicated(x$date_)) works for just one ID, but i am having
However if above works on one id so use split sapply/lapply approach.
Split your data according to id and use sapply or lapply wit above
function for splitted object. I believe this is what ddply does so maybe
it can be used too.
> trouble figuring out how to apply this to each subset of IDs (and
> the original data.frame structure)
> View this message in context: http://r.789695.n4.nabble.com/Subsetting-
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help