regularize.timestamps | R Documentation |
Given an set of timestamps that might contain duplicates and gaps, produce a set of timestamps that has no duplicates and no gaps.
RegularizeTimestamps(timestamps) ## Default S3 method: RegularizeTimestamps(timestamps) ## S3 method for class 'numeric' RegularizeTimestamps(timestamps) ## S3 method for class 'Date' RegularizeTimestamps(timestamps) ## S3 method for class 'POSIXt' RegularizeTimestamps(timestamps)
timestamps |
A set of (possibly irregular or non-unique)
timestamps. This could be a set of integers (like 1, 2, , 3...), a
set of numeric like (1945, 1945.083, 1945.167, ...) indicating years
and fractions of years, a |
If the argument is NULL
a
NULL
will be returned.
A set of regularly spaced timestamps of the same class as the argument
(which might be NULL
).
Steven L. Scott steve.the.bayesian@gmail.com
first <- as.POSIXct("2015-04-19 08:00:04") monthly <- seq(from = first, length.out = 24, by = "month") skip.one <- monthly[-8] has.duplicates <- monthly has.duplicates[2] <- has.duplicates[3] reg1 <- RegularizeTimestamps(skip.one) all.equal(reg1, monthly) ## TRUE reg2 <- RegularizeTimestamps(has.duplicates) all.equal(reg2, monthly) ## TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.