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-07-21 2020-09-19 2020-10-30 2021-01-27 2021-04-05 2021-05-10
#> Jan 2020   17.74438   14.81439   15.31656   15.59709   15.45832   15.67333
#> Feb 2020   19.48379   17.73673   19.46343   19.47018   19.30601   19.41495
#> Mar 2020   32.12770   27.59642   27.23370   28.05008   27.96610   27.96489
#> Apr 2020   30.41357   29.34196   29.64736   30.15862   29.45643   29.76080
#> May 2020   34.16074   32.48535   32.44867   33.32270   33.11976   32.91407
#> Jun 2020   31.06165   29.99436   29.00808   29.87555   29.99243   29.91109
#> Jul 2020   30.17426   32.54359   32.20112   32.33656   32.44320   32.42356
#> Aug 2020         NA   32.36805   29.67663   31.02521   30.56763   30.52123
#> Sep 2020         NA   30.63214   33.43325   33.01941   33.12313   33.09439
#> Oct 2020         NA         NA   31.62382   31.48291   30.99383   31.16888
#> Nov 2020         NA         NA         NA   35.63106   34.22295   34.33658
#> Dec 2020         NA         NA         NA   33.34942   36.41850   35.74701
#> Jan 2021         NA         NA         NA   41.60235   40.07063   40.20986
#> Feb 2021         NA         NA         NA         NA   41.50796   39.33363
#> Mar 2021         NA         NA         NA         NA   46.99544   48.24219
#> Apr 2021         NA         NA         NA         NA   53.36292   52.16409
#> May 2021         NA         NA         NA         NA         NA   51.29232
#> Jun 2021         NA         NA         NA         NA         NA         NA
#> Jul 2021         NA         NA         NA         NA         NA         NA
#> Aug 2021         NA         NA         NA         NA         NA         NA
#> Sep 2021         NA         NA         NA         NA         NA         NA
#> Oct 2021         NA         NA         NA         NA         NA         NA
#> Nov 2021         NA         NA         NA         NA         NA         NA
#> Dec 2021         NA         NA         NA         NA         NA         NA