Re: [R] duplicate values

From: Erik Iverson <iverson_at_biostat.wisc.edu>
Date: Sun, 16 Nov 2008 12:29:01 -0600

Oliver Bandel wrote:
> Antje Nöthlich <antno <at> web.de> writes:
>
> [...]
>> Now for the whole dataframe i would like to delete rows that have the same
>> "Datetime" value as the prior row.
>
> Well, if you do this, then you loose data.
> is this really, what you want?
> Throwing away data?
> I would think it make sense, if all columns are equal, so that unique()
> could be used - then you only throw away data, which already is registered
> in your data frame.
>
> But when you throw away different values because of the same date-time,
> then there is the question: WHICH would you throw away?
> All but the first? Or do you want to select a maximum or minimum?

You end up doing this a lot in clinical trials at least, where you might only care about the first event per patient for a survival analysis, or first measurement of blood pressure for baseline data. It's not so much throwing data away, as limiting it for a certain analysis. Very common for me to do this sort of thing.

>
>
> You attempt looks strange to me...
>
>
> Ciao,
> Oliver
>
> ______________________________________________
> R-help_at_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_at_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. Received on Sun 16 Nov 2008 - 18:31:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 16 Nov 2008 - 19:30:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive