Skip to content

Commit 4ce704b

Browse files
authored
Bump default serialization version in use_data() to 3 (#2044)
* Fixes #1966 - bumped default serialization version in use_data() to 3 * addition of bullet in NEWS.md to alert for update to use_data() version bump * update param in use_data & related test for default version 3
1 parent 00552db commit 4ce704b

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# usethis (development version)
22

3+
* `use_data()` now uses serialization version 3 by default. (@laurabrianna, #2044)
34
* Reverse dependency checks are only suggested if they exist
45
(#1817, @seankross).
56

R/data.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
#' files. If you really want to do so, set this to `TRUE`.
1919
#' @param compress Choose the type of compression used by [save()].
2020
#' Should be one of "gzip", "bzip2", or "xz".
21-
#' @param version The serialization format version to use. The default, 2, was
22-
#' the default format from R 1.4.0 to 3.5.3. Version 3 became the default from
23-
#' R 3.6.0 and can only be read by R versions 3.5.0 and higher.
21+
#' @param version The serialization format version to use. The default, 3, can
22+
#' only be read by R versions 3.5.0 and higher. For R 1.4.0 to 3.5.3, use
23+
#' version 2.
2424
#' @inheritParams base::save
2525
#'
2626
#' @seealso The [data chapter](https://r-pkgs.org/data.html) of [R
@@ -38,7 +38,7 @@ use_data <- function(...,
3838
internal = FALSE,
3939
overwrite = FALSE,
4040
compress = "bzip2",
41-
version = 2,
41+
version = 3,
4242
ascii = FALSE) {
4343
check_is_package("use_data()")
4444

man/use_data.Rd

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-data.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ test_that("use_data() honors `overwrite` for internal data", {
6262
expect_identical(letters2, rev(letters))
6363
})
6464

65-
test_that("use_data() writes version 2 by default", {
65+
test_that("use_data() writes version 3 by default", {
6666
create_local_package()
6767

6868
x <- letters
69-
use_data(x, internal = TRUE, version = 2, compress = FALSE)
69+
use_data(x, internal = TRUE, compress = FALSE)
7070
expect_identical(
7171
rawToChar(readBin(proj_path("R", "sysdata.rda"), n = 4, what = "raw")),
72-
"RDX2"
72+
"RDX3"
7373
)
7474
})
7575

0 commit comments

Comments
 (0)