MakeStrictlyRegular: Make an xts object strictly regular.

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/MakeStrictlyRegular.R

Description

Fill in gaps in data, by day, using na.locf

Usage

1
2
3
  MakeStrictlyRegular(x, timespan = "", by = "min",
    tz = "America/Chicago", verbose = TRUE, na.rm = TRUE,
    maxgap = 5)

Arguments

x

xts object

timespan

time-of-day subset string (e.g. "T08:30/T15:00"). seealso TimeOfDaySubset

by

increment of the time sequence. seealso seq.POSIXt

tz

timezone to use with seq.POSIXt

verbose

logical. print to standard output the number of rows that were added to make the object strictly regular?

na.rm

Should leading NAs be removed?

maxgap

see na.locf

Details

By default, if there are 5 or more missing observations, they will not be filled in. This can be adjusted with maxgap. Also, note that this function operates on each day separately. Therefore, missing values at the beginning of a day will not be filled-in.

Value

a strictly regular xts object

Note

ALPHA code; not perfect

Author(s)

Garrett See

Examples

1
2
3
4
x <- align.time(.xts(1:1000, 60*1:1000))[-c(2, 4, 7, 8), ] # remove some rows at the begining
head(x[paste((start.x <- start(x)), "/")])
x2 <- MakeStrictlyRegular(x)
head(x2[paste(start.x, "/")])

qmao documentation built on May 2, 2019, 4:54 p.m.