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   18.11000         NA         NA         NA         NA         NA
#> 2020-05-21   14.40316   13.43107   15.23385   12.29521   8.838085         NA
#> 2021-04-10   16.05491   10.51488   11.67204   13.52966   8.007665   9.069492
#> 2021-04-28   16.52885   12.11831   11.32615   12.05611   8.265478   8.839012
#> 2021-08-19   15.88340   11.51422   10.69619   11.29239   7.713386   7.791090
#> 2021-09-05   15.56530   11.46423   11.01863   11.45159   8.202249   8.093163
#>            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   6.031410   5.851527   3.176974   3.383796   6.962033   1.869599
#> 2021-04-28   7.071565   3.472684   3.791099   7.038607  10.007389   4.263728
#> 2021-08-19   4.505398   2.831425   3.111724   6.387037   8.936994   3.930710
#> 2021-09-05   5.132030   2.701723   2.277719   5.854601   8.353295   4.306155
#>            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   5.781132   1.295249  0.3107951   9.102266         NA         NA
#> 2021-04-28   8.381007   2.309453  3.0778919  11.837512         NA         NA
#> 2021-08-19   7.116823   2.708123  4.4417912  11.287032   12.56768   16.50135
#> 2021-09-05   6.892612   1.491387  4.4993233  10.440129   11.15096   16.85334
#>            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   14.36433   15.29453         NA         NA         NA         NA
#> 2021-09-05   14.04707   15.05272    13.4367         NA         NA         NA