Skip to content

Commit

Permalink
Merge branch 'release/2.4.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
adamblake committed May 28, 2021
2 parents dce65c8 + 9264a35 commit f5d3b37
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 125 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/check-standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- develop
- release/*
pull_request:
branches:
Expand All @@ -27,6 +26,7 @@ jobs:
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
Expand Down Expand Up @@ -71,6 +71,12 @@ jobs:
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Install dependencies not on RSPM
if: ${{ matrix.config.r == '3.4' }}
run: |
install.packages(c("lme4", "car"), repos = "https://mran.microsoft.com/snapshot/2018-04-01")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Personal R files
**/*.Rproj
.Rproj.user
.Rhistory
.RData
Expand Down
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: supernova
Type: Package
Title: Judd, McClelland, & Ryan Formatting for ANOVA Output
Version: 2.4.0
Date: 2021-05-03
Version: 2.4.1
Date: 2021-05-28
Authors@R: c(
person(
"Adam", "Blake",
Expand All @@ -29,7 +29,7 @@ Description: Produces ANOVA tables in the format used by Judd, McClelland, and R
proportional reduction in error and formatting to improve ease the transition between the book
and R.
License: GPL-3
Depends: R (>= 3.5.0)
Depends: R (>= 3.4.0)
Suggests:
car,
covr,
Expand All @@ -48,7 +48,8 @@ Imports:
stringr,
vctrs,
pillar,
methods
methods,
backports
RoxygenNote: 7.1.1
URL: https://github.com/UCLATALL/supernova
BugReports: https://github.com/UCLATALL/supernova/issues
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# supernova 2.4.1

* Small tweaks to make the package work on R 3.4.0


# supernova 2.4.0

## New features
Expand Down
1 change: 1 addition & 0 deletions R/generate_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ drop_term <- function(fit, term) {
paste0(collapse = "") %>%
stringr::str_squish()
new_call_string <- sprintf("drop_term(%s, \"%s\")", call_string, term)
str2lang <- utils::getFromNamespace("str2lang", "backports")
reduced_fit$call <- str2lang(new_call_string)

oldClass(reduced_fit) <- "lm"
Expand Down
1 change: 1 addition & 0 deletions R/listwise_delete.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ listwise_delete.lm <- function(obj, vars = all.vars(formula(obj))) {
class = "supernova_missing_values_message"
)

str2lang <- utils::getFromNamespace("str2lang", "backports")
rlang::with_handlers(
eval(str2lang(call_string), envir = environment(as.formula(obj))),
supernova_missing_values_message = rlang::calling(function(cnd) {
Expand Down
6 changes: 4 additions & 2 deletions R/pairwise.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ pairwise_t <- function(fit, term = NULL, alpha = .05, correction = "none") {
t = number(statistic),
df = fit$df.residual,
lower = number(diff - margin), upper = number(diff + margin),
p_val = number(p, 4, leading_zero = FALSE)
p_val = number(p, 4, leading_zero = FALSE),
stringsAsFactors = FALSE
)

if (correction == "bonferroni") {
Expand Down Expand Up @@ -185,7 +186,8 @@ pairwise_tukey <- function(fit, term = NULL, alpha = .05) {
q = number(statistic),
df = fit$df.residual,
lower = number(diff - margin), upper = number(diff + margin),
p_adj = number(p, 4, leading_zero = FALSE)
p_adj = number(p, 4, leading_zero = FALSE),
stringsAsFactors = FALSE
)
})

Expand Down
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,8 @@ pairwise(lm(Thumb ~ Sex, data = supernova::Fingers))
#>
#> ── Tukey's Honestly Significant Differences ────────────────────────────────────
#> Model: Thumb ~ Sex
#>
#> ── Sex
#> 1 comparison of 2 levels
#> Sex
#> Levels: 2
#> Family-wise error-rate: 0.05
#>
#> group_1 group_2 diff pooled_se q df lower upper p_adj
Expand All @@ -635,26 +634,24 @@ pairwise(lm(Thumb ~ Sex, data = supernova::Fingers), correction = "none")
#>
#> ── Pairwise t-tests ────────────────────────────────────────────────────────────
#> Model: Thumb ~ Sex
#>
#> ── Sex
#> 1 comparison of 2 levels
#> Sex
#> Levels: 2
#> Family-wise error-rate: 0.05
#>
#> group_1 group_2 diff pooled_se t df lower upper p_val
#> <chr> <chr> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>
#> 1 male female 6.447 1.456 4.428 155 4.038 8.856 .0000
#> 1 male female 6.447 1.029 6.262 155 4.743 8.150 .0000
pairwise(lm(Thumb ~ Sex, data = supernova::Fingers), correction = "Bonferroni")
#>
#> ── Pairwise t-tests with Bonferroni correction ─────────────────────────────────
#> Model: Thumb ~ Sex
#>
#> ── Sex
#> 1 comparison of 2 levels
#> Sex
#> Levels: 2
#> Family-wise error-rate: 0.05
#>
#> group_1 group_2 diff pooled_se t df lower upper p_adj
#> <chr> <chr> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>
#> 1 male female 6.447 1.456 4.428 155 4.038 8.856 .0000
#> 1 male female 6.447 1.029 6.262 155 4.743 8.150 .0000
```

In these data the `Sex` variable did not have any other values than male
Expand All @@ -671,9 +668,8 @@ pairwise(lm(Thumb ~ Sex + Height, data = supernova::Fingers))
#>
#> ── Tukey's Honestly Significant Differences ────────────────────────────────────
#> Model: Thumb ~ Sex + Height
#>
#> ── Sex
#> 1 comparison of 2 levels
#> Sex
#> Levels: 2
#> Family-wise error-rate: 0.05
#>
#> group_1 group_2 diff pooled_se q df lower upper p_adj
Expand Down
7 changes: 3 additions & 4 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
## Release summary

This release adds a simple interface for running pairwise t and Tukey tests on a linear model.
Small tweaks to make the package work on R 3.4


## Test environments

- Local install on macOS Big Sur 11.3; R 4.0.4
- Win Builder via `devtools::check_win_devel()`
- R-Hub via `devtools::check_rhub()`
* (only note was about the Date field which is now updated)
- R-Hub via `devtools::check_rhub()`
- GitHub Actions
* Mac OS X, 10.15.7; R 4.0.5
* Microsoft Windows Server 2019, 10.0.17763; R 4.0.5
* Ubuntu, 20.04; R-devel, R 4.0.5
* Ubuntu, 20.04; R-devel, R 4.0.5, 3.4.4


## R CMD check results
Expand Down
1 change: 1 addition & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Bonferroni
Codecov
HSD
McClelland
PRE
README
Expand Down
21 changes: 21 additions & 0 deletions supernova.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
87 changes: 0 additions & 87 deletions tests/testthat/_snaps/pairwise.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,90 +2,3 @@

`correction` must be one of "none", "Bonferroni", or "Tukey".

# catch all other data here

Code
pairwise_t(fit)
Message <cliMessage>
-- Pairwise t-tests ------------------------------------------------------------
Model: Thumb ~ RaceEthnic
Output
Message <cliMessage>
RaceEthnic
Levels: 5
Family-wise error-rate: 0.401
Output
group_1 group_2 diff pooled_se t df lower upper p_val
<chr> <chr> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>
1 African Amer~ White 2.985 2.023 1.476 152 -0.363 6.333 .1421
2 Asian White -0.964 1.182 -0.816 152 -2.920 0.992 .4160
3 Latino White -1.796 1.434 -1.253 152 -4.169 0.577 .2122
4 Other White 5.929 1.953 3.037 152 2.698 9.161 .0028
5 Asian African Amer~ -3.949 2.003 -1.971 152 -7.265 -0.634 .0505
6 Latino African Amer~ -4.782 2.162 -2.212 152 -8.359 -1.204 .0285
7 Other African Amer~ 2.944 2.536 1.161 152 -1.252 7.140 .2474
8 Latino Asian -0.832 1.406 -0.592 152 -3.159 1.495 .5548
9 Other Asian 6.894 1.932 3.567 152 3.696 10.092 .0005
10 Other Latino 7.726 2.096 3.686 152 4.257 11.194 .0003

---

Code
pairwise_bonferroni(fit)
Message <cliMessage>
-- Pairwise t-tests with Bonferroni correction ---------------------------------
Model: Thumb ~ RaceEthnic
Output
Message <cliMessage>
RaceEthnic
Levels: 5
Family-wise error-rate: 0.049
Output
group_1 group_2 diff pooled_se t df lower upper p_adj
<chr> <chr> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>
1 African Ame~ White 2.985 2.023 1.476 152 -2.292 8.263 1.0000
2 Asian White -0.964 1.182 -0.816 152 -4.047 2.119 1.0000
3 Latino White -1.796 1.434 -1.253 152 -5.536 1.944 1.0000
4 Other White 5.929 1.953 3.037 152 0.836 11.023 .0282
5 Asian African Ame~ -3.949 2.003 -1.971 152 -9.175 1.276 .5049
6 Latino African Ame~ -4.782 2.162 -2.212 152 -10.420 0.857 .2845
7 Other African Ame~ 2.944 2.536 1.161 152 -3.670 9.559 1.0000
8 Latino Asian -0.832 1.406 -0.592 152 -4.500 2.835 1.0000
9 Other Asian 6.894 1.932 3.567 152 1.853 11.934 .0048
10 Other Latino 7.726 2.096 3.686 152 2.258 13.193 .0032

---

Code
pairwise_tukey(fit)
Message <cliMessage>
-- Tukey's Honestly Significant Differences ------------------------------------
Model: Thumb ~ RaceEthnic
Output
Message <cliMessage>
RaceEthnic
Levels: 5
Family-wise error-rate: 0.05
Output
group_1 group_2 diff pooled_se q df lower upper p_adj
<chr> <chr> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>
1 African Amer~ White 2.985 2.023 1.476 152 -4.913 10.884 .8347
2 Asian White -0.964 1.182 -0.816 152 -5.579 3.651 .9783
3 Latino White -1.796 1.434 -1.253 152 -7.394 3.802 .9018
4 Other White 5.929 1.953 3.037 152 -1.695 13.554 .2058
5 Asian African Ame~ -3.949 2.003 -1.971 152 -11.771 3.872 .6325
6 Latino African Ame~ -4.782 2.162 -2.212 152 -13.221 3.658 .5227
7 Other African Ame~ 2.944 2.536 1.161 152 -6.956 12.844 .9238
8 Latino Asian -0.832 1.406 -0.592 152 -6.322 4.657 .9935
9 Other Asian 6.894 1.932 3.567 152 -0.651 14.438 .0910
10 Other Latino 7.726 2.096 3.686 152 -0.458 15.909 .0742

10 changes: 0 additions & 10 deletions tests/testthat/test-pairwise.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,6 @@ test_that("pairwise_t family-wise error-rate is larger than alpha when more than
})


# Catch all -----------------------------------------------------------------------------------

test_that("catch all other data here", {
fit <- lm(Thumb ~ RaceEthnic, supernova::Fingers)
expect_snapshot(pairwise_t(fit))
expect_snapshot(pairwise_bonferroni(fit))
expect_snapshot(pairwise_tukey(fit))
})


# Plots ---------------------------------------------------------------------------------------

test_that("each type of comparisons object plots well", {
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-print.supernova.R
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ test_that("nested repeated measures tables are beautifully formatted", {
})

test_that("crossed repeated measures tables are beautifully formatted", {
skip_if(
package_version(R.version) < 3.5,
"The MSE between will be off negligibly on older R versions (~.001)."
)

model <- fit_lmer(
rating ~ sex * yearsmarried * children + (1 | couple),
data = get_data("jmr_ex11.22")
Expand Down
8 changes: 7 additions & 1 deletion tests/testthat/test-supernova.lmerMod.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ test_that("supernova object has table, fit, and models", {
MS = double(),
`F` = double(),
PRE = double(),
p = double()
p = double(),
stringsAsFactors = FALSE
))
})

Expand All @@ -89,6 +90,11 @@ test_that("magrittr can pipe lmer() to supernova", {
})

test_that("magrittr can pipe data to lm() to supernova", {
skip_if(
package_version(R.version) < 3.5,
"This is only skipped to make this package compatible with DataCamp Light."
)

# Believe it or not, this might not work. Do not remove or refactor test.
# When stats::update() tries to get the call, the data object is just "."
# supernova has to middle-man with supernova::update() to get this to work
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-supernova.r
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ test_that("supernova table structure is well-formed", {
MS = double(),
`F` = double(),
PRE = double(),
p = double()
p = double(),
stringsAsFactors = FALSE
))
})

Expand Down

0 comments on commit f5d3b37

Please sign in to comment.