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.874153   4.0309885   3.937761   4.346651   4.716562   4.482794
#> Feb 2020         NA   3.9628217   2.903219   3.080858   3.748300   3.401983
#> Mar 2020         NA  -6.7620308  -3.905692  -4.001507  -4.121974  -4.158158
#> Apr 2020         NA  -0.9674696  -5.722316  -4.805492  -4.694201  -4.746578
#> May 2020         NA -10.2385517  -6.001260  -5.827252  -5.881428  -5.648682
#> Jun 2020         NA   2.0707425  -1.537056  -1.863279  -2.323824  -2.120270
#> Jul 2020         NA  -3.0481503  -0.646667  -1.048806  -1.118378  -1.068818
#> Aug 2020         NA          NA   4.387181   6.488015   6.977883   6.174244
#> Sep 2020         NA          NA  10.809740  10.936168  10.653148  11.278094
#> Oct 2020         NA          NA  12.518243   7.794404   8.601416   9.528623
#> Nov 2020         NA          NA         NA   8.003401   8.867413   6.577074
#> Dec 2020         NA          NA         NA   5.025893   8.231938   7.745609
#> Jan 2021         NA          NA         NA   6.209836   5.412647   6.121129
#> Feb 2021         NA          NA         NA  12.588476  10.524825   7.845852
#> Mar 2021         NA          NA         NA   7.665746   7.576131   9.025145
#> Apr 2021         NA          NA         NA   6.010005  10.042043   9.669766
#> May 2021         NA          NA         NA   9.945377   7.329128   7.057881
#> Jun 2021         NA          NA         NA   9.392826   9.645805   9.167228
#> Jul 2021         NA          NA         NA         NA  10.411747   7.528708
#> Aug 2021         NA          NA         NA         NA         NA  14.949975
#> Sep 2021         NA          NA         NA         NA         NA  13.464759
#> Oct 2021         NA          NA         NA         NA         NA  19.422880
#> Nov 2021         NA          NA         NA         NA         NA  14.844999
#> Dec 2021         NA          NA         NA         NA         NA  17.329474