convert_jyear(jyear, legacy = getOption("zipangu.convert_jyear.legacy", TRUE))Japanese imperial year (jyear). Kanji or Roman character
A logical to switch converter. If TRUE (the default), use the
legacy converter based on lubridate. If FALSE, use the 'ICU' implementation
via stringi::stri_datetime_parse() with the ja-JP-u-ca-japanese locale.
The default can also be controlled globally by
options(zipangu.convert_jyear.legacy = FALSE).
The non-legacy implementation depends on the system 'ICU' library through
stringi. On some platforms (notably macOS with system 'ICU'), parsing with
the ja-JP-u-ca-japanese locale can abort the R process. The legacy path is
therefore used by default. See https://github.com/uribo/zipangu/issues/60.
convert_jyear("R1")
#> [1] 2019
convert_jyear("Heisei2")
#> [1] 1990
convert_jyear("\u5e73\u6210\u5143\u5e74")
#> [1] 1989
convert_jyear(c("\u662d\u548c10\u5e74", "\u5e73\u621014\u5e74"))
#> [1] 1935 2002
convert_jyear(kansuji2arabic_all("\u5e73\u6210\u4e09\u5e74"))
#> [1] 1991