Skip to content

Commit

Permalink
Support R 4.0.0 change of default to stringsAsFactors = FALSE
Browse files Browse the repository at this point in the history
  • Loading branch information
hmalmedal committed Mar 20, 2020
1 parent cb649d7 commit 1ce3bac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/testthat/test-output.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ test_that("value objects give correct output", {
txt1 <- toJSONstat(df1)
expect_equal(fromJSONstat(txt1, use_factors = TRUE),
data.frame(V1 = letters,
value = c(1, rep(NA, 25))))
value = c(1, rep(NA, 25)),
stringsAsFactors = TRUE))
df2 <- data.frame(V1 = factor(letters[1:2], letters), value = 1:2)
txt2 <- toJSONstat(df2)
expect_equal(fromJSONstat(txt2, use_factors = TRUE),
data.frame(V1 = letters,
value = c(1:2, rep(NA, 24))))
value = c(1:2, rep(NA, 24)),
stringsAsFactors = TRUE))
})

test_that("named and unnamed lists give the same output", {
Expand Down

0 comments on commit 1ce3bac

Please sign in to comment.