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-14 2020-07-25 2020-10-16  2021-06-16  2021-07-04  2022-01-15
#> Jan 2020   2.855788  4.0126234  3.9193957   4.3282855   4.6981965   4.4644286
#> Feb 2020         NA  2.4252055  1.3656031   1.5432419   2.2106841   1.8643665
#> Mar 2020         NA -0.8512128  2.0051260   1.9093114   1.7888443   1.7526603
#> Apr 2020         NA  5.5046077  0.7497610   1.6665853   1.7778767   1.7254992
#> May 2020         NA -2.1580835  2.0792084   2.2532159   2.1990401   2.4317865
#> Jun 2020         NA  8.3192651  4.7114665   4.3852437   3.9246992   4.1282522
#> Jul 2020         NA  6.8793380  9.2808212   8.8786825   8.8091097   8.8586705
#> Aug 2020         NA         NA  4.8998156   7.0006494   7.4905179   6.6868784
#> Sep 2020         NA         NA  0.4158787   0.5423069   0.2592871   0.8842327
#> Oct 2020         NA         NA -0.6963385  -5.4201777  -4.6131651  -3.6859589
#> Nov 2020         NA         NA         NA  -5.1027002  -4.2386877  -6.5290272
#> Dec 2020         NA         NA         NA  -9.1592958  -5.9532509  -6.4395796
#> Jan 2021         NA         NA         NA  -8.3657164  -9.1629058  -8.4544234
#> Feb 2021         NA         NA         NA  -9.7616856 -11.8253368 -14.5043094
#> Mar 2021         NA         NA         NA -15.5254569 -15.6150720 -14.1660576
#> Apr 2021         NA         NA         NA -19.7848204 -15.7527819 -16.1250588
#> May 2021         NA         NA         NA -12.1559815 -14.7722310 -15.0434779
#> Jun 2021         NA         NA         NA  -8.9018931  -8.6489139  -9.1274908
#> Jul 2021         NA         NA         NA          NA  -3.1825871  -6.0656260
#> Aug 2021         NA         NA         NA          NA          NA  -5.2826250
#> Sep 2021         NA         NA         NA          NA          NA -18.3996610
#> Oct 2021         NA         NA         NA          NA          NA -22.8155554
#> Nov 2021         NA         NA         NA          NA          NA -23.1229457
#> Dec 2021         NA         NA         NA          NA          NA -22.9752523