Skip to content

Commit

Permalink
Fix tests for {poorman} update (#220)
Browse files Browse the repository at this point in the history
* Fix tests for `{poorman}` update

* use namespace

* poorman update on CRAN

* Ready for CRAN?
  • Loading branch information
IndrajeetPatil authored Aug 18, 2022
1 parent 34cf6bf commit 0601442
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: datawizard
Title: Easy Data Wrangling and Statistical Transformations
Version: 0.5.0.1
Version: 0.5.1
Authors@R: c(
person("Indrajeet", "Patil", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-1995-6531", Twitter = "@patilindrajeets")),
Expand Down Expand Up @@ -46,7 +46,7 @@ Suggests:
lme4,
mediation,
parameters,
poorman,
poorman (>= 0.2.6),
psych,
readxl,
readr,
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# datawizard 0.5.1

* Fixes failing tests due to `{poorman}` update.

# datawizard 0.5.0

MAJOR CHANGES
Expand Down
7 changes: 2 additions & 5 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
## Test environments
* local R installation, R 4.2.0
* ubuntu 16.04 (on github-actions), R 4.2.0
* win-builder (devel)

## R CMD check results

0 errors | 0 warnings | 0 note

* Fixes failing tests due to `{poorman}` update.

## revdepcheck results

Expect test failures in a few of the reverse dependencies. The authors of these
Expand Down
26 changes: 13 additions & 13 deletions tests/testthat/test-data_reshape.R
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ test_that("error when overwriting existing column", {

test_that("reshape_wider equivalent to pivot_wider: ex 1", {
x <- fish_encounters %>%
pivot_wider(names_from = "station", values_from = "seen", values_fill = 0)
tidyr::pivot_wider(names_from = "station", values_from = "seen", values_fill = 0)

y <- fish_encounters %>%
reshape_wider(
Expand All @@ -467,7 +467,7 @@ test_that("reshape_wider equivalent to pivot_wider: ex 2", {
production$production <- rnorm(nrow(production))

x <- production %>%
pivot_wider(
tidyr::pivot_wider(
names_from = c(product, country),
values_from = production
)
Expand All @@ -483,7 +483,7 @@ test_that("reshape_wider equivalent to pivot_wider: ex 2", {

test_that("reshape_wider equivalent to pivot_wider: ex 3", {
x <- us_rent_income %>%
pivot_wider(
tidyr::pivot_wider(
names_from = variable,
values_from = c(estimate, moe)
)
Expand All @@ -499,7 +499,7 @@ test_that("reshape_wider equivalent to pivot_wider: ex 3", {

test_that("reshape_wider equivalent to pivot_wider: ex 4", {
x <- us_rent_income %>%
pivot_wider(
tidyr::pivot_wider(
names_from = variable,
names_sep = ".",
values_from = c(estimate, moe)
Expand Down Expand Up @@ -528,7 +528,7 @@ test_that("reshape_wider equivalent to pivot_wider: ex 5", {
contacts$person_id <- cumsum(contacts$field == "name")

x <- contacts %>%
pivot_wider(names_from = field, values_from = value)
tidyr::pivot_wider(names_from = field, values_from = value)

y <- contacts %>%
reshape_wider(names_from = "field", values_from = "value")
Expand All @@ -548,7 +548,7 @@ test_that("reshape_wider equivalent to pivot_wider: ex 6", {
production$production <- rnorm(nrow(production))

x <- production %>%
pivot_wider(
tidyr::pivot_wider(
names_from = c(product, country),
values_from = production,
names_glue = "prod_{product}_{country}"
Expand All @@ -573,7 +573,7 @@ test_that("reshape_wider, names_glue works", {
)

x <- df %>%
pivot_wider(
tidyr::pivot_wider(
id_cols = food,
names_from = c(car, binary),
names_glue = "{binary}_{car}",
Expand All @@ -598,7 +598,7 @@ test_that("reshape_wider, names_glue works", {

test_that("reshape_longer equivalent to pivot_longer: ex 1", {
x <- relig_income %>%
pivot_longer(!religion, names_to = "income", values_to = "count")
tidyr::pivot_longer(!religion, names_to = "income", values_to = "count")

y <- relig_income %>%
reshape_longer(select = -religion, names_to = "income", values_to = "count")
Expand All @@ -609,7 +609,7 @@ test_that("reshape_longer equivalent to pivot_longer: ex 1", {

test_that("reshape_longer equivalent to pivot_longer: ex 2", {
x <- billboard %>%
pivot_longer(
tidyr::pivot_longer(
cols = starts_with("wk"),
names_to = "week",
values_to = "rank"
Expand All @@ -628,7 +628,7 @@ test_that("reshape_longer equivalent to pivot_longer: ex 2", {

test_that("reshape_longer equivalent to pivot_longer: ex 3", {
x <- billboard %>%
pivot_longer(
tidyr::pivot_longer(
cols = starts_with("wk"),
names_to = "week",
values_to = "rank",
Expand All @@ -649,7 +649,7 @@ test_that("reshape_longer equivalent to pivot_longer: ex 3", {

test_that("reshape_longer equivalent to pivot_longer: ex 4", {
x <- billboard %>%
pivot_longer(
tidyr::pivot_longer(
cols = starts_with("wk"),
names_to = "week",
names_prefix = "wk",
Expand All @@ -673,7 +673,7 @@ test_that("reshape_longer equivalent to pivot_longer: ex 4", {
test_that("reshape_longer equivalent to pivot_longer: ex 5", {
suppressWarnings({
x <- who %>%
pivot_longer(
tidyr::pivot_longer(
cols = 5:60,
names_to = c("diagnosis", "gender", "age"),
names_sep = "_",
Expand All @@ -694,7 +694,7 @@ test_that("reshape_longer equivalent to pivot_longer: ex 5", {

test_that("reshape_longer equivalent to pivot_longer: ex 6", {
x <- who %>%
pivot_longer(
tidyr::pivot_longer(
cols = new_sp_m014:newrel_f65,
names_to = c("diagnosis", "gender", "age"),
names_pattern = "new_?(.*)_(.)(.*)",
Expand Down

0 comments on commit 0601442

Please sign in to comment.