[R] delete repeated values - not unique...
wdunlap at tibco.com
Tue Feb 16 19:11:42 CET 2010
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of jorgusch
> Sent: Tuesday, February 16, 2010 9:01 AM
> To: r-help at r-project.org
> Subject: [R] delete repeated values - not unique...
> I must be blind not to see it, but I have the following vector:
> What I would like to have as a result is:
> All repeated values are gone. I cannot use unique for this,
> as the second 4
> would disappear. Is there another fast function for this problem?
Is this what you want? It keeps only those values
which are the not the same as the previous value in the
> isFirstInRun <- function(x) c(TRUE, x[-1]!=x[-length(x)])
> data <- c(4, 4, 5, 6, 6, 4)
 4 5 6 4
Spotfire, TIBCO Software
> Thanks in advance!
> View this message in context:
> 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