make.index.unique

0th

Percentile

Force Time Values To Be Unique

A generic function to force sorted time vectors to be unique. Useful for high-frequency time-series where original time-stamps may have identical values. For the case of xts objects, the default eps is set to ten microseconds. In practice this advances each subsequent identical time by eps over the previous (possibly also advanced) value.

Keywords
ts
Usage
make.index.unique(x, eps = 1e-06, drop=FALSE, fromLast=FALSE, ...)

make.time.unique(x, eps = 1e-06, drop=FALSE, fromLast=FALSE, ...)

Arguments
x

An xts object, or POSIXct vector.

eps

value to add to force uniqueness.

drop

drop duplicates instead of adjusting by eps

fromLast

if drop=TRUE, fromLast controls which duplicated times are dropped. If fromLast=FALSE, the earliest observation with an identical timestamp is kept with subsequent observations dropped.

unused

Details

The returned time-series object will have new time-stamps so that isOrdered( .index(x) ) evaluates to TRUE.

Value

A modified version of x.

Note

Incoming values must be pre-sorted, and no check is done to make sure that this is the case. If the index values are of storage.mode ‘integer’, they will be coerced to ‘double’ if drop=FALSE.

See Also

align.time

Aliases
  • make.index.unique
  • make.time.unique
  • is.index.unique
  • is.time.unique
Examples
library(xts) # NOT RUN { ds <- options(digits.secs=6) # so we can see the change x <- xts(1:10, as.POSIXct("2011-01-21") + c(1,1,1,2:8)/1e3) x make.index.unique(x) options(ds) # }
Documentation reproduced from package xts, version 0.9-7, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.