Skip to contents

Check vertical format

Usage

check_vertical(x, ...)

# S3 method for class 'mts'
check_vertical(x, periodicity, date_format = "%Y-%m-%d", ...)

# S3 method for class 'data.frame'
check_vertical(x, ...)

# S3 method for class 'matrix'
check_vertical(x, periodicity, date_format = "%Y-%m-%d", ...)

# Default S3 method
check_vertical(x, ...)

Arguments

x

a formatted data.frame containing the input in the vertical format

...

Arguments to be passed to check_vertical according to the class of the object x

periodicity

Integer. Periodicity of the time period (12, 4 or 1 for resp. monthly, quarterly or annual data)

date_format

character string corresponding to the format used in the input data.frame for the revision dates.

Value

the same input but in a ts object and with revision date formatted

Examples


long_format <- rjd3revisions:::simulate_long(
    start_period = as.Date("2020-01-01"),
    n_period = 24,
    n_revision = 6,
    periodicity = 12L
)
vertical_format <- rjd3revisions:::from_long_to_vertical(long_format, periodicity = 12L)
check_vertical(vertical_format)
#>          2020-01-11 2020-01-13 2020-05-03 2020-09-16 2020-11-16 2021-12-25
#> Jan 2020   14.58506   16.98654   16.58440   16.51483   16.56439   16.36432
#> Feb 2020         NA         NA   17.93613   18.91586   17.30858   17.45693
#> Mar 2020         NA         NA   15.28507   14.71903   15.96892   16.12966
#> Apr 2020         NA         NA   13.16446   14.77848   16.63289   16.35054
#> May 2020         NA         NA   19.03346   14.45279   14.27668   15.07819
#> Jun 2020         NA         NA         NA   16.98525   14.82049   14.42189
#> Jul 2020         NA         NA         NA   27.89842   28.64027   27.60844
#> Aug 2020         NA         NA         NA   23.36860   26.00591   25.96111
#> Sep 2020         NA         NA         NA   29.62559   26.68803   28.70405
#> Oct 2020         NA         NA         NA         NA   28.24833   29.34373
#> Nov 2020         NA         NA         NA         NA   26.08113   25.53863
#> Dec 2020         NA         NA         NA         NA         NA   24.43172
#> Jan 2021         NA         NA         NA         NA         NA   29.75531
#> Feb 2021         NA         NA         NA         NA         NA   26.02134
#> Mar 2021         NA         NA         NA         NA         NA   24.24393
#> Apr 2021         NA         NA         NA         NA         NA   24.98468
#> May 2021         NA         NA         NA         NA         NA   23.88830
#> Jun 2021         NA         NA         NA         NA         NA   15.50337
#> Jul 2021         NA         NA         NA         NA         NA   33.19885
#> Aug 2021         NA         NA         NA         NA         NA   34.38272
#> Sep 2021         NA         NA         NA         NA         NA   38.03876
#> Oct 2021         NA         NA         NA         NA         NA   39.85300
#> Nov 2021         NA         NA         NA         NA         NA   37.53872
#> Dec 2021         NA         NA         NA         NA         NA   28.11405