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   5.682236         NA         NA         NA         NA         NA
#> 2020-05-21   5.888302   4.477665  10.020547   18.95730   21.52292         NA
#> 2021-03-28   5.882799   5.300199   9.038902   15.12845   17.89364   15.11033
#> 2021-04-28   6.011332   5.590409  10.567581   13.86146   18.14009   15.66935
#> 2021-08-19   6.176073   5.915522  10.327862   14.76595   17.55082   14.93441
#> 2021-09-05   6.165749   5.981047  10.509387   14.83770   17.45763   14.93367
#>            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-03-28   12.09543   10.45360   15.99204   19.71226   25.41950   23.85058
#> 2021-04-28   10.56493   12.11892   17.46079   23.24339   21.65623   21.21424
#> 2021-08-19   12.13422   13.29101   16.59948   21.75010   23.03324   20.84615
#> 2021-09-05   11.73156   12.85003   16.52516   21.61187   22.39867   20.50059
#>            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-03-28   16.89140   21.05332   24.57955         NA         NA         NA
#> 2021-04-28   19.05996   22.54893   22.39893   22.31513         NA         NA
#> 2021-08-19   18.34627   22.16829   22.83952   22.75863   23.89293   21.80339
#> 2021-09-05   18.01705   21.29107   22.26034   24.07347   24.98238   21.03514
#>            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-03-28         NA         NA         NA         NA         NA         NA
#> 2021-04-28         NA         NA         NA         NA         NA         NA
#> 2021-08-19   24.12522   28.26140         NA         NA         NA         NA
#> 2021-09-05   22.54474   27.75989   28.86192         NA         NA         NA