Description Usage Arguments Examples
Enforces regularity in data frame and xts
objects, by turning implicit
NA
s into explicit NA
s. In ts
objects, regularity is automatically
enforced.
1 | ts_regular(x, fill = NA)
|
x |
ts-boxable time series, an object of class |
fill |
instead of |
1 2 3 4 5 6 7 8 9 10 11 12 | x0 <- AirPassengers
x0[c(10, 15)] <- NA
x <- ts_na_omit(ts_dts(x0))
ts_regular(x)
ts_regular(x, fill = 0)
m <- mdeaths
m[c(10, 69)] <- NA
f <- fdeaths
f[c(1, 3, 15)] <- NA
ts_regular(ts_na_omit(ts_dts(ts_c(f, m))))
|
time value
1: 1949-01-01 112
2: 1949-02-01 118
3: 1949-03-01 132
4: 1949-04-01 129
5: 1949-05-01 121
---
140: 1960-08-01 606
141: 1960-09-01 508
142: 1960-10-01 461
143: 1960-11-01 390
144: 1960-12-01 432
time value
1: 1949-01-01 112
2: 1949-02-01 118
3: 1949-03-01 132
4: 1949-04-01 129
5: 1949-05-01 121
---
140: 1960-08-01 606
141: 1960-09-01 508
142: 1960-10-01 461
143: 1960-11-01 390
144: 1960-12-01 432
id time value
1: f 1974-02-01 689
2: f 1974-03-01 NA
3: f 1974-04-01 677
4: f 1974-05-01 522
5: f 1974-06-01 406
---
139: m 1979-08-01 975
140: m 1979-09-01 NA
141: m 1979-10-01 1081
142: m 1979-11-01 1294
143: m 1979-12-01 1341
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.