Skip to contents

Check horizontal format

Usage

check_horizontal(x, ...)

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

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

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

Arguments

x

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

...

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

date_format

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

Value

the same input but with date formatted

Examples


long_format <- rjd3revisions:::simulate_long(
    start_period = as.Date("2020-01-01"),
    n_period = 24,
    n_revision = 6,
    periodicity = 12L
)
horizontal_format <- rjd3revisions:::from_long_to_horizontal(long_format)
check_horizontal(horizontal_format)
#>            2020-01-01 2020-02-01 2020-03-01 2020-04-01 2020-05-01 2020-06-01
#> 2020-01-29   17.40573         NA         NA         NA         NA         NA
#> 2020-05-21   13.69889   18.38121  12.373791   3.663856  1.8193521         NA
#> 2021-04-10   15.35065   15.46503   8.811985   4.898309  0.9889315  -2.674434
#> 2021-04-28   15.82459   17.06846   8.466088   3.424757  1.2467450  -2.904914
#> 2021-08-19   15.17914   16.46437   7.836135   2.661036  0.6946527  -3.952836
#> 2021-09-05   14.86103   16.41438   8.158578   2.820243  1.1835161  -3.650763
#>            2020-07-01 2020-08-01 2020-09-01 2020-10-01 2020-11-01 2020-12-01
#> 2020-01-29         NA         NA         NA         NA         NA         NA
#> 2020-05-21         NA         NA         NA         NA         NA         NA
#> 2021-04-10  -3.003466   1.831284  -4.779747  -6.581322  -5.766350  -6.452953
#> 2021-04-28  -1.963311  -0.547560  -4.165621  -2.926511  -2.720994  -4.058824
#> 2021-08-19  -4.529477  -1.188819  -4.844996  -3.578081  -3.791389  -4.391842
#> 2021-09-05  -3.902845  -1.318521  -5.679002  -4.110517  -4.375088  -4.016397
#>            2021-01-01 2021-02-01 2021-03-01 2021-04-01 2021-05-01 2021-06-01
#> 2020-01-29         NA         NA         NA         NA         NA         NA
#> 2020-05-21         NA         NA         NA         NA         NA         NA
#> 2021-04-10  -4.420682 -0.4939560 -13.630704  -14.75602         NA         NA
#> 2021-04-28  -1.820807  0.5202480 -10.863607  -12.02077         NA         NA
#> 2021-08-19  -3.084991  0.9189182  -9.499707  -12.57125  -12.79469  -16.65044
#> 2021-09-05  -3.309202 -0.2978176  -9.442175  -13.41815  -14.21141  -16.29844
#>            2021-07-01 2021-08-01 2021-09-01 2021-10-01 2021-11-01 2021-12-01
#> 2020-01-29         NA         NA         NA         NA         NA         NA
#> 2020-05-21         NA         NA         NA         NA         NA         NA
#> 2021-04-10         NA         NA         NA         NA         NA         NA
#> 2021-04-28         NA         NA         NA         NA         NA         NA
#> 2021-08-19  -17.09364  -6.249615         NA         NA         NA         NA
#> 2021-09-05  -17.41090  -6.491423  -8.791888         NA         NA         NA