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-02-09   11.03852   19.64121         NA         NA         NA         NA
#> 2020-05-14   12.15756   14.50888   12.63198   10.19077   15.34463         NA
#> 2020-11-05   12.04232   15.76214   13.69714   13.84558   13.20384   13.64977
#> 2021-05-09   11.51836   16.53664   14.00420   13.19401   12.03644   15.15155
#> 2021-06-26   11.66939   16.23929   13.66451   12.66158   12.60749   15.52214
#> 2021-11-21   11.71752   16.15913   13.24751   13.01298   12.90676   16.17211
#>            2020-07-01 2020-08-01 2020-09-01 2020-10-01 2020-11-01 2020-12-01
#> 2020-02-09         NA         NA         NA         NA         NA         NA
#> 2020-05-14         NA         NA         NA         NA         NA         NA
#> 2020-11-05   12.90257   16.20057  10.087900  11.075289   8.771553         NA
#> 2021-05-09   12.00573   11.33363  10.318029   7.687677   9.123546  10.303363
#> 2021-06-26   14.07339   11.35254   8.034512  10.074370   7.800803  10.061555
#> 2021-11-21   14.32694   12.04432   8.718323   9.720191   7.721487   9.695674
#>            2021-01-01 2021-02-01 2021-03-01 2021-04-01 2021-05-01 2021-06-01
#> 2020-02-09         NA         NA         NA         NA         NA         NA
#> 2020-05-14         NA         NA         NA         NA         NA         NA
#> 2020-11-05         NA         NA         NA         NA         NA         NA
#> 2021-05-09   18.06003   21.84874   32.92860   30.83152   27.21595         NA
#> 2021-06-26   15.54430   25.35132   28.36219   26.61666   28.28259   32.22061
#> 2021-11-21   17.18292   25.13581   30.29632   28.61508   28.20085   26.38111
#>            2021-07-01 2021-08-01 2021-09-01 2021-10-01 2021-11-01 2021-12-01
#> 2020-02-09         NA         NA         NA         NA         NA         NA
#> 2020-05-14         NA         NA         NA         NA         NA         NA
#> 2020-11-05         NA         NA         NA         NA         NA         NA
#> 2021-05-09         NA         NA         NA         NA         NA         NA
#> 2021-06-26         NA         NA         NA         NA         NA         NA
#> 2021-11-21   28.17034   24.38626   12.32818   16.98235   17.54105         NA