-
Notifications
You must be signed in to change notification settings - Fork 301
Closed
Description
CRAN checks require that all exported objects contain only ASCII letters. The base save() function provides the argument ascii to save an rda file as ASCII compliant. This argument is not made available by usethis.
Spatial CRS will often (and frustratingly) contain non-ASCII letters. When these objects are exported they do not pass CRAN checks when saved with usethis.
An example is below
guerry <- sf::st_as_sf(Guerry::gfrance85) |>
janitor::clean_names() |>
sf::st_set_crs(27572) |>
tibble::as_tibble() |>
sf::st_as_sf()
# Save using usethis
usethis::use_data(guerry, overwrite = TRUE)
testthat::test_that("rda is ASCII", {
g <- tools::checkRdaFiles("data/guerry.rda")[["ASCII"]]
testthat::expect_true(g)
})
#> ββ Failure (Line 3): rda is ASCII ββββββββββββββββββββββββββββββββββββββββββββββ
#> `g` is not TRUE
#>
#> `actual`: FALSE
#> `expected`: TRUE
# Save using `save()`
save(guerry, file = "data/guerry.rda", ascii = TRUE)
testthat::test_that("rda is ASCII", {
g <- tools::checkRdaFiles("data/guerry.rda")[["ASCII"]]
testthat::expect_true(g)
})
#> Test passed π
Metadata
Metadata
Assignees
Labels
No labels