R package documentation .Rd symbols turned to utf codes, R cmd check now fails due to mismatch

Recently I was updating my package, and in the .Rd documentation file symbols were turned to utf codes.

image

Now the github actions R cmd checks are failing due to mismatch in code and documentation, but not failing locally.

Anyone have any clue how to resolve?

d> devtools::session_info()
─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.2.0 (2022-04-22 ucrt)
 os       Windows 10 x64 (build 19042)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  English_United States.utf8
 ctype    English_United States.utf8
 tz       America/New_York
 date     2022-09-02
 rstudio  2022.07.1+554 Spotted Wakerobin (desktop)
 pandoc   NA

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 !  package       * version    date (UTC) lib source
    assertthat      0.2.1      2019-03-21 [2] CRAN (R 4.1.1)
    brio            1.1.3      2021-11-30 [2] CRAN (R 4.2.0)
    broom.helpers   1.8.0      2022-07-05 [1] RSPM (R 4.2.0)
    bslib           0.3.1      2021-10-06 [2] CRAN (R 4.1.1)
    cachem          1.0.6      2021-08-19 [2] CRAN (R 4.1.1)
    callr           3.7.0      2021-04-20 [2] CRAN (R 4.1.1)
 P  cli             3.3.0      2022-04-25 [2] CRAN (R 4.2.0)
    colorspace      2.0-3      2022-02-21 [2] CRAN (R 4.2.0)
    commonmark      1.8.0      2022-03-09 [2] CRAN (R 4.2.0)
    crayon          1.5.1      2022-03-26 [2] CRAN (R 4.2.0)
    datapasta       3.1.0      2020-01-17 [2] CRAN (R 4.1.1)
    DBI             1.1.2      2021-12-20 [2] CRAN (R 4.2.0)
    desc            1.4.1      2022-03-06 [2] CRAN (R 4.2.0)
 VP devtools        2.4.3      2022-07-20 [2] CRAN (R 4.2.1) (on disk 2.4.4)
    diffobj         0.3.5      2021-10-05 [2] CRAN (R 4.1.1)
    diffviewer      0.1.1      2021-09-30 [1] CRAN (R 4.2.1)
    digest          0.6.29     2021-12-01 [2] CRAN (R 4.2.0)
    dplyr           1.0.9      2022-04-28 [1] CRAN (R 4.2.0)
    ellipsis        0.3.2      2021-04-29 [2] CRAN (R 4.1.1)
    evaluate        0.15       2022-02-18 [2] CRAN (R 4.1.3)
    fansi           1.0.3      2022-03-24 [2] CRAN (R 4.2.0)
    fastmap         1.1.0      2021-01-25 [2] CRAN (R 4.1.1)
    forcats         0.5.2      2022-08-19 [1] CRAN (R 4.2.1)
    fs              1.5.2      2021-12-08 [2] CRAN (R 4.1.2)
    generics        0.1.2      2022-01-31 [2] CRAN (R 4.2.0)
    ggplot2         3.3.6      2022-05-03 [2] CRAN (R 4.2.0)
    glue            1.6.2      2022-02-24 [2] CRAN (R 4.1.3)
    gt              0.7.0      2022-08-25 [1] CRAN (R 4.2.0)
    gtable          0.3.0      2019-03-25 [2] CRAN (R 4.1.1)
 P  gtreg         * 0.1.1.9000 2022-09-01 [?] load_all()
    gtsummary       1.6.1.9005 2022-09-01 [1] local
    hms             1.1.1      2021-09-26 [2] CRAN (R 4.1.1)
    htmltools       0.5.2      2021-08-25 [2] CRAN (R 4.1.1)
    htmlwidgets     1.5.4      2021-09-08 [2] CRAN (R 4.1.1)
    httpuv          1.6.5      2022-01-05 [2] CRAN (R 4.2.0)
    jquerylib       0.1.4      2021-04-26 [2] CRAN (R 4.1.1)
    jsonlite        1.8.0      2022-02-22 [2] CRAN (R 4.2.0)
    knitr           1.40       2022-08-24 [1] CRAN (R 4.2.1)
    later           1.3.0      2021-08-18 [2] CRAN (R 4.1.1)
    lifecycle       1.0.1      2021-09-24 [2] CRAN (R 4.1.1)
    magrittr        2.0.3      2022-03-30 [2] CRAN (R 4.2.0)
    memoise         2.0.1      2021-11-26 [2] CRAN (R 4.2.0)
    mime            0.12       2021-09-28 [2] CRAN (R 4.1.1)
    munsell         0.5.0      2018-06-12 [2] CRAN (R 4.1.1)
    pillar          1.7.0      2022-02-01 [1] CRAN (R 4.2.0)
    pkgbuild        1.3.1      2021-12-20 [2] CRAN (R 4.2.0)
    pkgconfig       2.0.3      2019-09-22 [2] CRAN (R 4.1.1)
    pkgload         1.3.0      2022-06-27 [2] CRAN (R 4.2.1)
    prettyunits     1.1.1      2020-01-24 [2] CRAN (R 4.1.1)
    processx        3.5.3      2022-03-25 [2] CRAN (R 4.2.0)
    promises        1.2.0.1    2021-02-11 [2] CRAN (R 4.1.1)
    ps              1.7.0      2022-04-23 [2] CRAN (R 4.2.0)
    purrr           0.3.4      2020-04-17 [2] CRAN (R 4.1.1)
    R6              2.5.1      2021-08-19 [2] CRAN (R 4.1.1)
    rappdirs        0.3.3      2021-01-31 [2] CRAN (R 4.1.1)
    Rcpp            1.0.8.3    2022-03-17 [2] CRAN (R 4.2.0)
    readr           2.1.2      2022-01-30 [2] CRAN (R 4.2.0)
    rematch2        2.1.2      2020-05-01 [2] CRAN (R 4.1.1)
    remotes         2.4.2      2021-11-30 [2] CRAN (R 4.2.0)
 VP rlang           1.0.3      2022-07-12 [2] RSPM (R 4.2.0) (on disk 1.0.4)
    roxygen2        7.2.1      2022-07-18 [1] CRAN (R 4.2.1)
    rprojroot       2.0.3      2022-04-02 [2] CRAN (R 4.2.0)
    rstudioapi      0.13       2020-11-12 [2] CRAN (R 4.1.1)
    sass            0.4.1      2022-03-23 [2] CRAN (R 4.2.0)
    scales          1.2.0      2022-04-13 [2] CRAN (R 4.2.0)
    sessioninfo     1.2.2      2021-12-06 [2] CRAN (R 4.2.0)
    shiny         * 1.7.1      2021-10-02 [2] CRAN (R 4.1.1)
    shrtcts         0.1.2      2022-03-30 [2] Github (gadenbuie/shrtcts@12ef67f)
    stringi         1.7.6      2021-11-29 [2] CRAN (R 4.2.0)
    stringr         1.4.1      2022-08-20 [1] CRAN (R 4.2.1)
    testthat      * 3.1.4      2022-04-26 [1] CRAN (R 4.2.0)
    tibble          3.1.8      2022-07-22 [1] RSPM (R 4.2.0)
    tidyr           1.2.0      2022-02-01 [2] CRAN (R 4.1.3)
    tidyselect      1.1.2      2022-02-21 [2] CRAN (R 4.2.0)
    tzdb            0.3.0      2022-03-28 [2] CRAN (R 4.2.0)
    usethis         2.1.6      2022-05-25 [2] CRAN (R 4.2.0)
    utf8            1.2.2      2021-07-24 [2] CRAN (R 4.1.1)
    vctrs           0.4.1      2022-04-13 [1] CRAN (R 4.2.0)
    waldo           0.4.0      2022-03-16 [1] CRAN (R 4.2.0)
    withr           2.5.0      2022-03-03 [2] CRAN (R 4.2.0)
    xfun            0.31       2022-05-10 [2] CRAN (R 4.2.0)
    xml2            1.3.3      2021-11-30 [2] CRAN (R 4.2.0)
    xtable          1.8-4      2019-04-21 [2] CRAN (R 4.1.1)
    yaml            2.3.5      2022-02-21 [2] CRAN (R 4.2.0)

 [1] C:/Users/pileggis/R-dev
 [2] C:/Program Files/R/R-4.2.0/library

 V ── Loaded and on-disk version mismatch.
 P ── Loaded and on-disk path mismatch.
1 Like

this looks relevant mismatch of UTF-8 charachters between code and docs usage section · Issue #1186 · r-lib/roxygen2 · GitHub but not quite

2 Likes

maybe you can try supplying an @usage tag directly as suggested in that issue?

2 Likes

Do you have know of an example implementation of @usage? I'm not familiar with it and I'm not able to find much documentation.

1 Like

Do you have access to cs.github.com? If so maybe this search GitHub Code Search (Preview) helps

1 Like

It's annoying but I think the most stable way of writing the character would be as \u2014:

# instead of this
zero_symbol = "–"

# use this
zero_symbol = "\u2014"

I often use stringi to look these up

stringi::stri_escape_unicode("—")
#> [1] "\\u2014"

but remember to take away one \ since the function above escapes the unicode → \u2014.

1 Like

@grrrck is right. In fact you are not allowed to use Unicode characters in R source files, at least not in CRAN packages.

Thanks, all! @grrrck's solution worked! :tada:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.