diff --git a/.Rbuildignore b/.Rbuildignore
index 7e08f1fa..e4075a19 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -11,7 +11,10 @@
^CITATION\.cff$
^doc$
^Meta$
+R\.Rproj$
^codecov\.yml$
^cran-comments\.md$
^CRAN-SUBMISSION$
^\.lintr$
+.Rprofile$
+.Rprofile\.R$
diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml
index a3ac6182..b085ed52 100644
--- a/.github/workflows/R-CMD-check.yaml
+++ b/.github/workflows/R-CMD-check.yaml
@@ -2,9 +2,9 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
- branches: [main, master]
+ branches: [main, master, devel]
pull_request:
- branches: [main, master]
+ branches: [main, master, devel]
name: R-CMD-check
@@ -29,7 +29,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- uses: r-lib/actions/setup-pandoc@v2
diff --git a/.github/workflows/check-full.yaml b/.github/workflows/check-full.yaml
deleted file mode 100644
index 6faae3f0..00000000
--- a/.github/workflows/check-full.yaml
+++ /dev/null
@@ -1,58 +0,0 @@
-# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
-# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
-#
-# NOTE: This workflow is overkill for most R packages and
-# check-standard.yaml is likely a better choice.
-# usethis::use_github_action("check-standard") will install it.
-on:
- push:
- branches: [main, master]
- pull_request:
- branches: [main, master]
-
-name: R-CMD-check
-
-jobs:
- R-CMD-check:
- runs-on: ${{ matrix.config.os }}
-
- name: ${{ matrix.config.os }} (${{ matrix.config.r }})
-
- strategy:
- fail-fast: false
- matrix:
- config:
- - {os: macOS-latest, r: 'release'}
-
- - {os: windows-latest, r: 'release'}
- # Use 3.6 to trigger usage of RTools35
- - {os: windows-latest, r: '3.6'}
-
- # Use older ubuntu to maximise backward compatibility
- - {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'}
- - {os: ubuntu-18.04, r: 'release'}
- - {os: ubuntu-18.04, r: 'oldrel-1'}
- - {os: ubuntu-18.04, r: 'oldrel-2'}
- - {os: ubuntu-18.04, r: 'oldrel-3'}
- - {os: ubuntu-18.04, r: 'oldrel-4'}
-
- env:
- GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- R_KEEP_PKG_SOURCE: yes
-
- steps:
- - uses: actions/checkout@v2
-
- - uses: r-lib/actions/setup-pandoc@v1
-
- - uses: r-lib/actions/setup-r@v1
- with:
- r-version: ${{ matrix.config.r }}
- http-user-agent: ${{ matrix.config.http-user-agent }}
- use-public-rspm: true
-
- - uses: r-lib/actions/setup-r-dependencies@v1
- with:
- extra-packages: rcmdcheck
-
- - uses: r-lib/actions/check-r-package@v1
diff --git a/.github/workflows/check-release.yaml b/.github/workflows/check-release.yaml
deleted file mode 100644
index f9e6bda8..00000000
--- a/.github/workflows/check-release.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
-# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
-# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
-on:
- push:
- branches: [main, master]
- pull_request:
- branches: [main, master]
-
-name: R-CMD-check
-
-jobs:
- R-CMD-check:
- runs-on: ubuntu-latest
- env:
- GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- R_KEEP_PKG_SOURCE: yes
- steps:
- - uses: actions/checkout@v2
-
- - uses: r-lib/actions/setup-r@v2
- with:
- use-public-rspm: true
-
- - uses: r-lib/actions/setup-r-dependencies@v2
- with:
- extra-packages: rcmdcheck
-
- - uses: r-lib/actions/check-r-package@v2
- - if: runner.os == 'macOS'
- run: brew install --cask xquartz
diff --git a/.github/workflows/check-standard.yaml b/.github/workflows/check-standard.yaml
deleted file mode 100644
index 271d466e..00000000
--- a/.github/workflows/check-standard.yaml
+++ /dev/null
@@ -1,46 +0,0 @@
-# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
-# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
-on:
- push:
- branches: [main, master]
- pull_request:
- branches: [main, master]
-
-name: R-CMD-check
-
-jobs:
- R-CMD-check:
- runs-on: ${{ matrix.config.os }}
-
- name: ${{ matrix.config.os }} (${{ matrix.config.r }})
-
- strategy:
- fail-fast: false
- matrix:
- config:
- - {os: macOS-latest, r: 'release'}
- - {os: windows-latest, r: 'release'}
- - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- - {os: ubuntu-latest, r: 'release'}
- - {os: ubuntu-latest, r: 'oldrel-1'}
-
- env:
- GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- R_KEEP_PKG_SOURCE: yes
-
- steps:
- - uses: actions/checkout@v2
-
- - uses: r-lib/actions/setup-pandoc@v1
-
- - uses: r-lib/actions/setup-r@v1
- with:
- r-version: ${{ matrix.config.r }}
- http-user-agent: ${{ matrix.config.http-user-agent }}
- use-public-rspm: true
-
- - uses: r-lib/actions/setup-r-dependencies@v1
- with:
- extra-packages: rcmdcheck
-
- - uses: r-lib/actions/check-r-package@v1
diff --git a/.github/workflows/lint-project.yaml b/.github/workflows/lint-project.yaml
deleted file mode 100644
index f1a052c4..00000000
--- a/.github/workflows/lint-project.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
-# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
-# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
-on:
- push:
- branches: [main, master]
- pull_request:
- branches: [main, master]
-
-name: lint-project
-
-jobs:
- lint-project:
- runs-on: ubuntu-latest
- env:
- GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- steps:
- - uses: actions/checkout@v3
-
- - uses: r-lib/actions/setup-r@v2
- with:
- use-public-rspm: true
-
- - name: Install lintr
- run: install.packages("lintr")
- shell: Rscript {0}
-
- - name: Lint root directory
- run: lintr::lint_dir()
- shell: Rscript {0}
- env:
- LINTR_ERROR_ON_LINT: true
diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml
index f4c4ef2d..f60d0479 100644
--- a/.github/workflows/lint.yaml
+++ b/.github/workflows/lint.yaml
@@ -14,7 +14,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml
index ed7650c7..a7276e85 100644
--- a/.github/workflows/pkgdown.yaml
+++ b/.github/workflows/pkgdown.yaml
@@ -22,7 +22,7 @@ jobs:
permissions:
contents: write
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- uses: r-lib/actions/setup-pandoc@v2
@@ -41,7 +41,7 @@ jobs:
- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
- uses: JamesIves/github-pages-deploy-action@v4.4.1
+ uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml
new file mode 100644
index 00000000..960234cd
--- /dev/null
+++ b/.github/workflows/test-coverage.yaml
@@ -0,0 +1,50 @@
+# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
+# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
+on:
+ push:
+ branches: [main, master]
+ pull_request:
+ branches: [main, master]
+
+name: test-coverage
+
+jobs:
+ test-coverage:
+ runs-on: ubuntu-latest
+ env:
+ GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: r-lib/actions/setup-r@v2
+ with:
+ use-public-rspm: true
+
+ - uses: r-lib/actions/setup-r-dependencies@v2
+ with:
+ extra-packages: any::covr
+ needs: coverage
+
+ - name: Test coverage
+ run: |
+ covr::codecov(
+ quiet = FALSE,
+ clean = FALSE,
+ install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
+ )
+ shell: Rscript {0}
+
+ - name: Show testthat output
+ if: always()
+ run: |
+ ## --------------------------------------------------------------------
+ find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
+ shell: bash
+
+ - name: Upload test results
+ if: failure()
+ uses: actions/upload-artifact@v4
+ with:
+ name: coverage-test-failures
+ path: ${{ runner.temp }}/package
diff --git a/DESCRIPTION b/DESCRIPTION
index 11a47969..0686d058 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -21,7 +21,7 @@ License: GPL (>= 3)
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
-RoxygenNote: 7.2.3
+RoxygenNote: 7.3.1
Imports:
cli,
corrr,
@@ -69,6 +69,7 @@ Collate:
'grim-map.R'
'data-doc.R'
'data-frame-predicates.R'
+ 'seq-predicates.R'
'function-map-seq.R'
'debit-map-seq.R'
'disperse.R'
@@ -108,19 +109,16 @@ Collate:
'scrutiny-package.R'
'seq-disperse.R'
'seq-length.R'
- 'seq-predicates.R'
'split-by-parens.R'
'subset-superset.R'
'utils-pipe.R'
'utils-tidy-eval.R'
'write-doc-audit.R'
Suggests:
- covr,
- devtools,
knitr,
+ pkgload,
rmarkdown,
- roxygen2,
- testthat (>= 3.0.0),
+ testthat (>= 3.0.0)
Config/testthat/edition: 3
Depends:
R (>= 3.4.0)
diff --git a/NAMESPACE b/NAMESPACE
index a242af06..98da84b3 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -12,7 +12,6 @@ S3method(audit,scr_grimmer_map)
export("%>%")
export(":=")
export("seq_length<-")
-export()
export(.data)
export(anti_trunc)
export(as_label)
diff --git a/R/function-map-total-n.R b/R/function-map-total-n.R
index 6ae32961..6fa94c48 100644
--- a/R/function-map-total-n.R
+++ b/R/function-map-total-n.R
@@ -331,7 +331,7 @@ function_map_total_n <- function(.fun, .reported, .name_test,
check_tibble(data)
# Make sure that the `n` column is present...
- if (!any("n" == colnames(data))) {
+ if (!"n" %in% colnames(data)) {
cli::cli_abort(c(
"Column `n` missing.",
"i" = "`n` should contain the reported total sample sizes \\
diff --git a/R/function-map.R b/R/function-map.R
index 0b091ddb..10901484 100644
--- a/R/function-map.R
+++ b/R/function-map.R
@@ -150,10 +150,10 @@ function_map <- function(.fun, .reported, .name_test,
})
code_rounding_class <-
- if (any("rounding" == names(formals(.fun)))) {
+ if ("rounding" %in% names(formals(.fun))) {
rlang::expr({
dots <- rlang::enexprs(...)
- if (any("rounding" == names(dots))) {
+ if ("rounding" %in% names(dots)) {
rounding_class <- dots$rounding
} else {
rounding_class <- formals(fun)$rounding
diff --git a/R/method-dup-count.R b/R/method-dup-count.R
index 46c18979..feedaf8c 100644
--- a/R/method-dup-count.R
+++ b/R/method-dup-count.R
@@ -3,7 +3,7 @@
#' @export
audit.scr_dup_count <- function(data) {
- if (any(colnames(data) == "locations_n")) {
+ if ("locations_n" %in% colnames(data)) {
audit_summary_stats(data, c("count", "locations_n"))
} else {
audit_summary_stats(data, "count")
diff --git a/R/method-grim-sequence.R b/R/method-grim-sequence.R
index 4743e327..0d567fa9 100644
--- a/R/method-grim-sequence.R
+++ b/R/method-grim-sequence.R
@@ -4,7 +4,7 @@
explain_seq_test_ranking <- function(x, scr_func_info) {
- if (!any("lead_lag" == colnames(x))) {
+ if (!"lead_lag" %in% colnames(x)) {
x$lead_lag <- NA
}
@@ -110,7 +110,7 @@ explain_seq_test_ranking <- function(x, scr_func_info) {
seq_test_ranking <- function(x, explain = TRUE) {
- if (!any("consistency" == colnames(x))) {
+ if (!"consistency" %in% colnames(x)) {
cli::cli_abort(c(
"Column `consistency` is missing.",
"i" = "Only run `seq_test_ranking()` on the output of a \\
diff --git a/R/method-grimmer-map.R b/R/method-grimmer-map.R
index 3ceafa4d..1cd33847 100644
--- a/R/method-grimmer-map.R
+++ b/R/method-grimmer-map.R
@@ -3,7 +3,7 @@
audit.scr_grimmer_map <- function(data) {
out <- audit_cols_minimal(data, "GRIMMER")
- if (any("reason" == colnames(data))) {
+ if ("reason" %in% colnames(data)) {
reason <- data$reason[!is.na(data$reason)]
fail_grim <- length(reason[stringr::str_detect(reason, "GRIM inconsistent")])
fail_test1 <- length(reason[stringr::str_detect(reason, "test 1")])
diff --git a/README.Rmd b/README.Rmd
index 52297201..7ee2915c 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -1,14 +1,5 @@
---
-title: "Error detection in science"
-output:
- rmarkdown::md_document:
-
-vignette: >
- %\VignetteIndexEntry{Error detection in science}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
- %\VignetteDepends{devtools}
-
+output: github_document
link-citations: TRUE
---
@@ -24,20 +15,16 @@ knitr::opts_chunk$set(
fig.asp = 7/7.5
)
-# Dev only: load scrutiny from scrutiny
-devtools::load_all(".")
-
# Determine ggplot2 theme for the session:
ggplot2::theme_set(ggplot2::theme_minimal())
```
-
-[{alt="R-CMD-check"}](https://github.com/lhdjung/scrutiny/actions/workflows/R-CMD-check.yaml) [](https://app.codecov.io/gh/lhdjung/scrutiny?branch=main)
-
+[](https://github.com/lhdjung/scrutiny/actions/workflows/R-CMD-check.yaml)
+[](https://app.codecov.io/gh/lhdjung/scrutiny?branch=main)
-# Error detection in science
+# scrutiny: Error detection in science
The goal of scrutiny is to test published summary statistics for consistency using techniques like GRIM and to check their plausibility. The package makes these methods easy to use in a tidyverse-friendly way. It hopes to help the new field of error detection go mainstream.
diff --git a/README.md b/README.md
index 904d7d4c..5748612b 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,13 @@
+
-[
](https://github.com/lhdjung/scrutiny/actions/workflows/R-CMD-check.yaml)
+[](https://github.com/lhdjung/scrutiny/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/lhdjung/scrutiny?branch=main)
-
-# Error detection in science
+# scrutiny: Error detection in science
The goal of scrutiny is to test published summary statistics for
consistency using techniques like GRIM and to check their plausibility.
@@ -28,11 +26,15 @@ issue](https://github.com/lhdjung/scrutiny/issues) first.
Install the package from CRAN:
- install.packages("scrutiny")
+``` r
+install.packages("scrutiny")
+```
Alternatively, install the development version from GitHub:
- remotes::install_github("lhdjung/scrutiny")
+``` r
+remotes::install_github("lhdjung/scrutiny")
+```
## Get started
@@ -40,112 +42,120 @@ Here is how to GRIM-test all values in a data frame. When using
`grim_map()`, the `consistency` column tells you if the means (`x`) and
sample sizes (`n`) are mutually consistent.
- library(scrutiny)
-
- # Example data:
- pigs1
- #> # A tibble: 12 × 2
- #> x n
- #>
- #> 1 7.22 32
- #> 2 4.74 25
- #> 3 5.23 29
- #> 4 2.57 24
- #> 5 6.77 27
- #> 6 2.68 28
- #> 7 7.01 29
- #> 8 7.38 26
- #> 9 3.14 27
- #> 10 6.89 31
- #> 11 5.00 25
- #> 12 0.24 28
-
- # GRIM-testing for data frames:
- grim_map(pigs1)
- #> # A tibble: 12 × 4
- #> x n consistency ratio
- #>
- #> 1 7.22 32 TRUE 0.68
- #> 2 4.74 25 FALSE 0.75
- #> 3 5.23 29 FALSE 0.71
- #> 4 2.57 24 FALSE 0.76
- #> 5 6.77 27 FALSE 0.73
- #> 6 2.68 28 TRUE 0.72
- #> 7 7.01 29 FALSE 0.71
- #> 8 7.38 26 TRUE 0.74
- #> 9 3.14 27 FALSE 0.73
- #> 10 6.89 31 FALSE 0.69
- #> 11 5.00 25 TRUE 0.75
- #> 12 0.24 28 FALSE 0.72
+``` r
+library(scrutiny)
+
+# Example data:
+pigs1
+#> # A tibble: 12 × 2
+#> x n
+#>
+#> 1 7.22 32
+#> 2 4.74 25
+#> 3 5.23 29
+#> 4 2.57 24
+#> 5 6.77 27
+#> 6 2.68 28
+#> 7 7.01 29
+#> 8 7.38 26
+#> 9 3.14 27
+#> 10 6.89 31
+#> 11 5.00 25
+#> 12 0.24 28
+
+# GRIM-testing for data frames:
+grim_map(pigs1)
+#> # A tibble: 12 × 4
+#> x n consistency ratio
+#>
+#> 1 7.22 32 TRUE 0.68
+#> 2 4.74 25 FALSE 0.75
+#> 3 5.23 29 FALSE 0.71
+#> 4 2.57 24 FALSE 0.76
+#> 5 6.77 27 FALSE 0.73
+#> 6 2.68 28 TRUE 0.72
+#> 7 7.01 29 FALSE 0.71
+#> 8 7.38 26 TRUE 0.74
+#> 9 3.14 27 FALSE 0.73
+#> 10 6.89 31 FALSE 0.69
+#> 11 5.00 25 TRUE 0.75
+#> 12 0.24 28 FALSE 0.72
+```
Test percentages instead of means:
- pigs2
- #> # A tibble: 6 × 2
- #> x n
- #>
- #> 1 67.4 150
- #> 2 54.2 150
- #> 3 54.0 150
- #> 4 69.8 150
- #> 5 68.1 150
- #> 6 55.4 150
-
- grim_map(pigs2, percent = TRUE)
- #> ℹ `x` converted from percentage
- #> # A tibble: 6 × 4
- #> x n consistency ratio
- #>
- #> 1 0.674 150 FALSE 0.85
- #> 2 0.542 150 FALSE 0.85
- #> 3 0.540 150 TRUE 0.85
- #> 4 0.698 150 FALSE 0.85
- #> 5 0.681 150 FALSE 0.85
- #> 6 0.554 150 FALSE 0.85
+``` r
+pigs2
+#> # A tibble: 6 × 2
+#> x n
+#>
+#> 1 67.4 150
+#> 2 54.2 150
+#> 3 54.0 150
+#> 4 69.8 150
+#> 5 68.1 150
+#> 6 55.4 150
+
+grim_map(pigs2, percent = TRUE)
+#> ℹ `x` converted from percentage
+#> # A tibble: 6 × 4
+#> x n consistency ratio
+#>
+#> 1 0.674 150 FALSE 0.85
+#> 2 0.542 150 FALSE 0.85
+#> 3 0.540 150 TRUE 0.85
+#> 4 0.698 150 FALSE 0.85
+#> 5 0.681 150 FALSE 0.85
+#> 6 0.554 150 FALSE 0.85
+```
You can choose how the means are reconstructed for testing — below,
rounded up from 5. When visualizing results, the plot will adjust
automatically. Blue dots are consistent values, red dots are
inconsistent ones:
- pigs1 %>%
- grim_map(rounding = "up") %>%
- grim_plot()
+``` r
+pigs1 %>%
+ grim_map(rounding = "up") %>%
+ grim_plot()
+```
Similarly, use DEBIT to test means and standard deviations of binary
data:
- pigs3
- #> # A tibble: 7 × 3
- #> x sd n
- #>
- #> 1 0.53 0.50 1683
- #> 2 0.44 0.50 1683
- #> 3 0.77 0.42 1683
- #> 4 0.19 0.35 1683
- #> 5 0.34 0.47 1683
- #> 6 0.93 0.25 1683
- #> 7 0.12 0.33 1683
-
- pigs3 %>%
- debit_map()
- #> # A tibble: 7 × 11
- #> x sd n consistency rounding sd_lower sd_incl_lower sd_upper
- #>
- #> 1 0.53 0.50 1683 TRUE up_or_down 0.495 TRUE 0.505
- #> 2 0.44 0.50 1683 TRUE up_or_down 0.495 TRUE 0.505
- #> 3 0.77 0.42 1683 TRUE up_or_down 0.415 TRUE 0.425
- #> 4 0.19 0.35 1683 FALSE up_or_down 0.345 TRUE 0.355
- #> 5 0.34 0.47 1683 TRUE up_or_down 0.465 TRUE 0.475
- #> 6 0.93 0.25 1683 TRUE up_or_down 0.245 TRUE 0.255
- #> 7 0.12 0.33 1683 TRUE up_or_down 0.325 TRUE 0.335
- #> # ℹ 3 more variables: sd_incl_upper , x_lower , x_upper
-
- pigs3 %>%
- debit_map() %>%
- debit_plot()
+``` r
+pigs3
+#> # A tibble: 7 × 3
+#> x sd n
+#>
+#> 1 0.53 0.50 1683
+#> 2 0.44 0.50 1683
+#> 3 0.77 0.42 1683
+#> 4 0.19 0.35 1683
+#> 5 0.34 0.47 1683
+#> 6 0.93 0.25 1683
+#> 7 0.12 0.33 1683
+
+pigs3 %>%
+ debit_map()
+#> # A tibble: 7 × 11
+#> x sd n consistency rounding sd_lower sd_incl_lower sd_upper
+#>
+#> 1 0.53 0.50 1683 TRUE up_or_down 0.495 TRUE 0.505
+#> 2 0.44 0.50 1683 TRUE up_or_down 0.495 TRUE 0.505
+#> 3 0.77 0.42 1683 TRUE up_or_down 0.415 TRUE 0.425
+#> 4 0.19 0.35 1683 FALSE up_or_down 0.345 TRUE 0.355
+#> 5 0.34 0.47 1683 TRUE up_or_down 0.465 TRUE 0.475
+#> 6 0.93 0.25 1683 TRUE up_or_down 0.245 TRUE 0.255
+#> 7 0.12 0.33 1683 TRUE up_or_down 0.325 TRUE 0.335
+#> # ℹ 3 more variables: sd_incl_upper , x_lower , x_upper
+
+pigs3 %>%
+ debit_map() %>%
+ debit_plot()
+```
diff --git a/scrutiny.Rproj b/scrutiny.Rproj
index 69fafd4b..e4e949a0 100644
--- a/scrutiny.Rproj
+++ b/scrutiny.Rproj
@@ -20,3 +20,5 @@ BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
+
+UseNativePipeOperator: No
diff --git a/tests/testthat/test-audit.R b/tests/testthat/test-audit.R
index eda29b06..723ec079 100644
--- a/tests/testthat/test-audit.R
+++ b/tests/testthat/test-audit.R
@@ -7,7 +7,7 @@ data_grim <- grim_map(pigs1)
audit_grim <- audit(data_grim)
test_that("`audit()` summarizes GRIM tests accurately", {
- expect_true(is.data.frame(audit_grim))
+ expect_s3_class(audit_grim, "data.frame")
expect_equal(as.numeric(audit_grim$all_cases - audit_grim$incons_cases),
length(data_grim$consistency[data_grim$consistency]))
})
diff --git a/tests/testthat/test-debit-map.R b/tests/testthat/test-debit-map.R
index e6d5faf9..b4c2adb7 100644
--- a/tests/testthat/test-debit-map.R
+++ b/tests/testthat/test-debit-map.R
@@ -5,11 +5,11 @@ df1_tested <- debit_map(df1)
test_that("the output is a tibble", {
- df1_tested %>% tibble::is_tibble() %>% expect_true()
+ df1_tested %>% expect_s3_class("tbl_df")
})
test_that("values are correctly tested for DEBIT-consistency", {
- df1_tested$consistency[df1_tested$consistency] %>% length() %>% expect_equal(6)
+ df1_tested$consistency[df1_tested$consistency] %>% expect_length(6L)
})
test_that("`show_rec` controls the number of columns", {
diff --git a/tests/testthat/test-debit-plot.R b/tests/testthat/test-debit-plot.R
index 4f2b624c..61d205df 100644
--- a/tests/testthat/test-debit-plot.R
+++ b/tests/testthat/test-debit-plot.R
@@ -6,7 +6,7 @@ plot1 <- pigs3 %>%
test_that("`debit_plot()` returns a ggplot object", {
- plot1 %>% ggplot2::is.ggplot() %>% expect_true()
+ plot1 %>% expect_s3_class("ggplot")
})
test_that("The S3 inheritance check works correctly", {
diff --git a/tests/testthat/test-disperse.R b/tests/testthat/test-disperse.R
index dd62b10a..b96e09f6 100644
--- a/tests/testthat/test-disperse.R
+++ b/tests/testthat/test-disperse.R
@@ -3,12 +3,11 @@
df1 <- disperse(n = 20, dispersion = 0:5)
test_that("The function returns a tibble", {
- df1 %>% tibble::is_tibble() %>% expect_true()
+ df1 %>% expect_s3_class("tbl_df")
})
test_that("It has the right dimensions", {
- df1 %>% nrow() %>% expect_equal(12)
- df1 %>% ncol() %>% expect_equal(2)
+ df1 %>% dim() %>% expect_equal(c(12, 2))
})
test_that("It starts with the right values", {
diff --git a/tests/testthat/test-grim-granularity.R b/tests/testthat/test-grim-granularity.R
index b3ace7db..38363349 100644
--- a/tests/testthat/test-grim-granularity.R
+++ b/tests/testthat/test-grim-granularity.R
@@ -1,10 +1,10 @@
test_that("`grim_granularity()` returns a numeric value", {
- grim_granularity(20, 1) %>% is.numeric() %>% expect_true()
- grim_granularity(20, 2) %>% is.numeric() %>% expect_true()
- grim_granularity(25, 1) %>% is.numeric() %>% expect_true()
- grim_granularity(25, 2) %>% is.numeric() %>% expect_true()
+ grim_granularity(20, 1) %>% expect_type("double")
+ grim_granularity(20, 2) %>% expect_type("double")
+ grim_granularity(25, 1) %>% expect_type("double")
+ grim_granularity(25, 2) %>% expect_type("double")
})
diff --git a/tests/testthat/test-grim-map-total-n.R b/tests/testthat/test-grim-map-total-n.R
index 0bb41595..4c6e530d 100644
--- a/tests/testthat/test-grim-map-total-n.R
+++ b/tests/testthat/test-grim-map-total-n.R
@@ -50,7 +50,7 @@ df2_rows_1_3_expected <- tibble::tibble(
),
case = rep(rep(1:2, 2), each = 12L),
dir = factor(rep(c("forth", "back"), each = 24L), levels = c("forth", "back")),
-) |>
+) %>%
structure(
class = c(
"scr_map_total_n", "scr_grim_map", "scr_rounding_up_or_down", "tbl_df", "tbl",
@@ -67,8 +67,8 @@ df2_tested <- df2 %>% grim_map_total_n(dispersion = 0:5)
test_that("The output is a tibble", {
- df1_tested %>% tibble::is_tibble() %>% expect_true()
- df2_tested %>% tibble::is_tibble() %>% expect_true()
+ expect_s3_class(df1_tested, "tbl_df")
+ expect_s3_class(df2_tested, "tbl_df")
})
test_that("It has correct dimensions", {
@@ -88,8 +88,8 @@ colnames_exp <- c(
test_that("It has correct column names", {
- df1_tested %>% colnames() %>% expect_equal(colnames_exp)
- df2_tested %>% colnames() %>% expect_equal(colnames_exp)
+ df1_tested %>% expect_named(colnames_exp)
+ df2_tested %>% expect_named(colnames_exp)
})
diff --git a/tests/testthat/test-grim-map.R b/tests/testthat/test-grim-map.R
index 2600f821..9d174aa0 100644
--- a/tests/testthat/test-grim-map.R
+++ b/tests/testthat/test-grim-map.R
@@ -17,26 +17,24 @@ df1_grim <- grim_map(df1)
test_that("A tibble is returned", {
- df1_grim %>% is.data.frame() %>% expect_true()
- df1_grim %>% inherits("tbl_df") %>% expect_true()
- df1_grim %>% inherits("tbl") %>% expect_true()
+ expect_s3_class(df1_grim, c("tbl_df", "tbl", "data.frame"))
})
test_that("It has the correct function-general class", {
- expect_true(inherits(df1_grim, "scr_grim_map"))
+ expect_s3_class(df1_grim, "scr_grim_map")
})
test_that("It has the correct rounding-specific class", {
- df1_grim_up_or_down %>% inherits("scr_rounding_up_or_down") %>% expect_true()
- df1_grim_up %>% inherits("scr_rounding_up") %>% expect_true()
- df1_grim_down %>% inherits("scr_rounding_down") %>% expect_true()
- df1_grim_ceiling_or_floor %>% inherits("scr_rounding_ceiling_or_floor") %>% expect_true()
- df1_grim_ceiling %>% inherits("scr_rounding_ceiling") %>% expect_true()
- df1_grim_floor %>% inherits("scr_rounding_floor") %>% expect_true()
- df1_grim_trunc %>% inherits("scr_rounding_trunc") %>% expect_true()
- df1_grim_anti_trunc %>% inherits("scr_rounding_anti_trunc") %>% expect_true()
+ df1_grim_up_or_down %>% expect_s3_class("scr_rounding_up_or_down")
+ df1_grim_up %>% expect_s3_class("scr_rounding_up")
+ df1_grim_down %>% expect_s3_class("scr_rounding_down")
+ df1_grim_ceiling_or_floor %>% expect_s3_class("scr_rounding_ceiling_or_floor")
+ df1_grim_ceiling %>% expect_s3_class("scr_rounding_ceiling")
+ df1_grim_floor %>% expect_s3_class("scr_rounding_floor")
+ df1_grim_trunc %>% expect_s3_class("scr_rounding_trunc")
+ df1_grim_anti_trunc %>% expect_s3_class("scr_rounding_anti_trunc")
})
@@ -159,7 +157,7 @@ df7 <- df1 %>%
test_that("`show_prob` adds a `prob` column", {
- "prob" %in% colnames(df7) %>% expect_true()
+ expect_contains(colnames(df7), "prob")
})
diff --git a/tests/testthat/test-grim-plot.R b/tests/testthat/test-grim-plot.R
index 88491225..3a39af7f 100644
--- a/tests/testthat/test-grim-plot.R
+++ b/tests/testthat/test-grim-plot.R
@@ -4,5 +4,5 @@ plot <- pigs1 %>%
grim_plot()
test_that("`grim_plot()` returns a ggplot object", {
- plot %>% inherits("ggplot") %>% expect_true()
+ plot %>% expect_s3_class("ggplot")
})
diff --git a/tests/testthat/test-grim.R b/tests/testthat/test-grim.R
index ecd464e4..55a05995 100644
--- a/tests/testthat/test-grim.R
+++ b/tests/testthat/test-grim.R
@@ -7,8 +7,8 @@ test_that("A numeric argument for `x` leads to failure", {
test_that("Return values are Boolean", {
- expect_true(is.logical(grim("5.19", 28)))
- expect_true(is.logical(grim("0.00", 100)))
+ expect_type(grim("5.19", 28), "logical")
+ expect_type(grim("0.00", 100), "logical")
})
@@ -78,14 +78,10 @@ test_that("Correct values are returned (`percent` argument)", {
vec <- seq_endpoint(5, 5.99)
-vec_all_right_name <- vec %>%
- grim(28) %>%
- hasName(vec) %>%
- all()
test_that("The `x` vector reappears as the names of the return values", {
- vec_all_right_name %>% expect_true()
+ expect_named(grim(vec, 28), vec)
})
@@ -106,7 +102,7 @@ x <- rnorm(x_length, 50, 20) %>%
test_that("There are as many outputs as inputs", {
- grim(x, 50) %>% length() %>% expect_equal(x_length)
+ grim(x, 50) %>% expect_length(x_length)
})
diff --git a/tests/testthat/test-method-grim-map.R b/tests/testthat/test-method-grim-map.R
index 77690298..38acfb29 100644
--- a/tests/testthat/test-method-grim-map.R
+++ b/tests/testthat/test-method-grim-map.R
@@ -12,16 +12,14 @@ audit_pigs2 <- pigs2 %>%
test_that("The output is a tibble", {
- audit_pigs1 %>% tibble::is_tibble() %>% expect_true()
- audit_pigs2 %>% tibble::is_tibble() %>% expect_true()
+ audit_pigs1 %>% expect_s3_class("tbl_df")
+ audit_pigs2 %>% expect_s3_class("tbl_df")
})
test_that("The output has correct dimensions", {
- audit_pigs1 %>% ncol() %>% expect_equal(7)
- audit_pigs1 %>% nrow() %>% expect_equal(1)
- audit_pigs2 %>% ncol() %>% expect_equal(7)
- audit_pigs2 %>% nrow() %>% expect_equal(1)
+ audit_pigs1 %>% dim() %>% expect_equal(c(1, 7))
+ audit_pigs2 %>% dim() %>% expect_equal(c(1, 7))
})
diff --git a/tests/testthat/test-method-grim-sequence.R b/tests/testthat/test-method-grim-sequence.R
index 034b9f7c..e82935e0 100644
--- a/tests/testthat/test-method-grim-sequence.R
+++ b/tests/testthat/test-method-grim-sequence.R
@@ -7,7 +7,7 @@ ranking <- seq_distance_df("5.37", n = 40) %>%
test_that("The function returns a tibble", {
- ranking %>% tibble::is_tibble() %>% expect_true()
+ ranking %>% expect_s3_class("tbl_df")
})
test_that("Dimensions are correct", {
diff --git a/tests/testthat/test-restore-zeros.R b/tests/testthat/test-restore-zeros.R
index 928efd43..6ef61ed2 100644
--- a/tests/testthat/test-restore-zeros.R
+++ b/tests/testthat/test-restore-zeros.R
@@ -41,8 +41,7 @@ test_that("The `*_df()` variant produces correct results", {
dplyr::select(5) %>%
restore_zeros_df() %>%
dplyr::pull(1) %>%
- is.factor() %>%
- expect_true()
+ expect_s3_class("factor")
})
@@ -53,24 +52,13 @@ test_that("the `check_decimals` argument works correctly", {
dplyr::pull(1) %>%
expect_type("double")
- iris %>%
- dplyr::mutate(Sepal.Length = trunc(Sepal.Length)) %>%
- restore_zeros_df(check_decimals = FALSE) %>%
- dplyr::pull(1) %>%
- expect_warning()
-
- iris %>%
- dplyr::mutate(Sepal.Length = trunc(Sepal.Length)) %>%
- restore_zeros_df(check_decimals = FALSE) %>%
- dplyr::pull(1) %>%
- expect_warning()
-
- iris %>%
- dplyr::mutate(Sepal.Length = trunc(Sepal.Length)) %>%
- restore_zeros_df(check_decimals = FALSE) %>%
- dplyr::pull(1) %>%
- suppressWarnings() %>%
- expect_type("character")
+ expect_warning(
+ out <- iris %>%
+ dplyr::mutate(Sepal.Length = trunc(Sepal.Length)) %>%
+ restore_zeros_df(check_decimals = FALSE) %>%
+ dplyr::pull(1)
+ )
+ expect_type(out, "character")
})
diff --git a/tests/testthat/test-split-by-parens.R b/tests/testthat/test-split-by-parens.R
index 941f4730..32907390 100644
--- a/tests/testthat/test-split-by-parens.R
+++ b/tests/testthat/test-split-by-parens.R
@@ -13,14 +13,14 @@ pigs_tested <- split_by_parens(pigs)
test_that("The output is a tibble", {
- pigs_tested %>% tibble::is_tibble() %>% expect_true()
+ expect_s3_class(pigs_tested, "tbl_df")
})
colnames_expected <- c("drone_x", "drone_sd", "selfpilot_x", "selfpilot_sd")
test_that("It has correct column names", {
- pigs_tested %>% colnames() %>% expect_equal(colnames_expected)
+ expect_named(pigs_tested, colnames_expected)
})
@@ -89,13 +89,13 @@ test_that("using the dots, `...`, is an error", {
pigs_wider <- pigs %>% dplyr::mutate(letters = letters[1:4])
test_that("non-`sep` columns are handled correctly with `check_sep = TRUE` (the default)", {
- pigs_wider %>% split_by_parens() %>% expect_warning()
- pigs_wider %>% split_by_parens() %>% suppressWarnings() %>% ncol() %>% expect_equal(5L)
+ expect_warning(out <- split_by_parens(pigs_wider))
+ expect_equal(ncol(out), 5L)
})
test_that("non-`sep` columns are handled correctly with `check_sep = FALSE", {
- pigs_wider %>% split_by_parens(check_sep = FALSE) %>% expect_warning()
- pigs_wider %>% split_by_parens(check_sep = FALSE) %>% suppressWarnings() %>% ncol() %>% expect_equal(6L)
+ expect_warning(out <- split_by_parens(pigs_wider, check_sep = FALSE))
+ expect_equal(ncol(out), 6L)
})
diff --git a/tests/testthat/test-unround.R b/tests/testthat/test-unround.R
index aa7bbba5..d2323121 100644
--- a/tests/testthat/test-unround.R
+++ b/tests/testthat/test-unround.R
@@ -4,12 +4,12 @@ df1 <- unround(c(3.6, "5.20", 5.174)) %>%
test_that("The output is a tibble", {
- df1 %>% tibble::is_tibble() %>% expect_true()
+
+ df1 %>% expect_s3_class("tbl_df")
})
test_that("It has correct dimensions", {
- df1 %>% nrow() %>% expect_equal(3)
- df1 %>% ncol() %>% expect_equal(7)
+ df1 %>% dim() %>% expect_equal(c(3, 7))
})
diff --git a/vignettes/consistency-tests.Rmd b/vignettes/consistency-tests.Rmd
index f6a30f1a..2bc44ac7 100644
--- a/vignettes/consistency-tests.Rmd
+++ b/vignettes/consistency-tests.Rmd
@@ -5,6 +5,7 @@ vignette: >
%\VignetteIndexEntry{Implementing consistency tests}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
+ %\VignetteDepends{pkgload}
bibliography: references.bib
---
@@ -13,11 +14,7 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
-```
-
-```{r include=FALSE}
-# Dev only: load scrutiny from within scrutiny
-devtools::load_all(".")
+pkgload::load_all()
```
```{r setup}
@@ -126,7 +123,7 @@ As you can see, `function_map()` is not a helper used inside other functions whe
To export a function manufactured this way from your own package, make sure to follow [this purrr FAQ](https://purrr.tidyverse.org/reference/faq-adverbs-export.html). (Incredible as it sounds, scrutiny will then take on the role of purrr.) Your version should look about like this:
-```{r eval=FALSE}
+```r
schlim_map <- function(...) "dummy"
.onLoad <- function(lib, pkg) {
diff --git a/vignettes/debit.Rmd b/vignettes/debit.Rmd
index a11c347f..6e91b7b9 100644
--- a/vignettes/debit.Rmd
+++ b/vignettes/debit.Rmd
@@ -9,7 +9,6 @@ vignette: >
%\VignetteIndexEntry{DEBIT}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
- %\VignetteDepends{devtools}
bibliography: references.bib
---
@@ -20,11 +19,6 @@ knitr::opts_chunk$set(
)
```
-```{r include=FALSE}
-# Dev only: load scrutiny from within scrutiny
-devtools::load_all(".")
-```
-
```{r setup, message=FALSE}
library(scrutiny)
```
@@ -57,7 +51,7 @@ As in `grim()`, the mean needs to be a string. (The same is true for the SD.) Th
If you want to test more than a handful of cases, the recommended way is to enter them into a data frame and to run `debit_map()` on the data frame. Below are the example data from Heathers and Brown's (2019) Table 1. A useful way to enter such data is to copy them from a PDF file and paste them into `tibble::tribble()`, which is available via scrutiny:
```{r}
-flying_pigs <- tibble(
+flying_pigs <- tibble::tibble(
x = runif(5, 0.2, 1) %>% round(2) %>% restore_zeros(),
sd = runif(5, 0, 0.3) %>% round(2) %>% restore_zeros(),
n = 1000
diff --git a/vignettes/duplicates.Rmd b/vignettes/duplicates.Rmd
index 24eb84ee..9bc592fb 100644
--- a/vignettes/duplicates.Rmd
+++ b/vignettes/duplicates.Rmd
@@ -14,10 +14,6 @@ knitr::opts_chunk$set(
)
```
-```{r include=FALSE}
-# Dev only: load scrutiny from within scrutiny
-devtools::load_all(".")
-```
```{r setup}
library(scrutiny)
diff --git a/vignettes/grim.Rmd b/vignettes/grim.Rmd
index 82eb0cff..39a69122 100644
--- a/vignettes/grim.Rmd
+++ b/vignettes/grim.Rmd
@@ -9,7 +9,6 @@ vignette: >
%\VignetteIndexEntry{GRIM}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
- %\VignetteDepends{devtools}
bibliography: references.bib
---
@@ -20,10 +19,6 @@ knitr::opts_chunk$set(
)
```
-```{r include=FALSE}
-# Dev only: load scrutiny from within scrutiny
-devtools::load_all(".")
-```
```{r setup, message=FALSE}
library(scrutiny)
@@ -64,7 +59,7 @@ If you want to GRIM-test more than a handful of cases, the recommended way is to
Copy summary data from a PDF file and paste them into `tibble::tribble()`, which is available via scrutiny:
```{r}
-flying_pigs1 <- tribble(
+flying_pigs1 <- tibble::tribble(
~x,
"8.97",
"2.61",
@@ -74,7 +69,7 @@ flying_pigs1 <- tribble(
"10.46",
"7.39"
) %>%
- mutate(n = 28)
+ dplyr::mutate(n = 28)
```
Use RStudio's multiple cursors to draw quotation marks around all the `x` values, and to set commas at the end. See `vignette("wrangling")`, section *With copy and paste*, if you are not sure how to do that.
@@ -92,7 +87,7 @@ The `x` and `n` columns are the same as in the input. By default, the number of
If a mean is composed of multiple items, set the `items` parameter to that number. Below are hypothetical means of a three-items scale. With the single-item default, half of these are wrongly flagged as inconsistent:
```{r, error=TRUE}
-jpap_1 <- tribble(
+jpap_1 <- tibble::tribble(
~x,
"5.90",
"5.71",
@@ -101,7 +96,7 @@ jpap_1 <- tribble(
"4.61",
"5.24",
) %>%
- mutate(n = 40)
+ dplyr::mutate(n = 40)
jpap_1 %>%
grim_map() # default is wrong here!
@@ -117,7 +112,7 @@ jpap_1 %>%
It is also possible to include an `items` column in the data frame instead:
```{r, error=TRUE}
-jpap_2 <- tribble(
+jpap_2 <- tibble::tribble(
~x, ~items,
"6.92", 1,
"3.48", 1,
@@ -139,7 +134,7 @@ An underappreciated strength of GRIM is testing percentages. Since these are act
Both `grim()` and `grim_map()` have a `percent` parameter which, if set to `TRUE`, divides the `x` values by 100 and increases the decimal count by two, so that percentages can be tested just like means:
```{r}
-jpap_3 <- tribble(
+jpap_3 <- tibble::tribble(
~x, ~n,
"32.5", 438,
"35.6", 455,
@@ -251,7 +246,7 @@ These columns are ---
There is a specialized visualization function for GRIM test results, `grim_plot()`:
```{r, error=TRUE, fig.width=6, fig.height=5.5}
-jpap_5 <- tribble(
+jpap_5 <- tibble::tribble(
~x, ~n,
"7.19", 28,
"4.56", 34,
@@ -362,7 +357,7 @@ More precisely, they went from a 20/20 group split to a 19/21 split, then to an
Instead of going about this manually, call `grim_map_total_n()`, followed by `audit_total_n()` for summarizing the results. It will find two further plausible scenarios in which both means are consistent; more on that below.
```{r}
-df <- tibble(x1 = "4.71", x2 = "5.3", n = 40)
+df <- tibble::tibble(x1 = "4.71", x2 = "5.3", n = 40)
# Detailed results:
df_tested <- grim_map_total_n(df)
diff --git a/vignettes/grimmer.Rmd b/vignettes/grimmer.Rmd
index 6d28b388..f15ba0f0 100644
--- a/vignettes/grimmer.Rmd
+++ b/vignettes/grimmer.Rmd
@@ -19,10 +19,6 @@ knitr::opts_chunk$set(
library(scrutiny)
```
-```{r include=FALSE}
-# Dev only: load scrutiny from within scrutiny
-devtools::load_all(".")
-```
Granularity-related inconsistency of means mapped to error repeats, or GRIMMER, is a test for the mathematical consistency of reported means or proportions with the corresponding standard deviations (SDs) and sample sizes [@anaya2016b; @allard2018].
@@ -63,7 +59,7 @@ If you want to GRIMMER-test more than a handful of cases, the recommended way is
Copy summary data from a PDF file and paste them into `tibble::tribble()`, which is available via scrutiny:
```{r}
-flying_pigs1 <- tribble(
+flying_pigs1 <- tibble::tribble(
~x, ~sd,
"8.9", "2.81",
"2.6", "2.05",
@@ -73,7 +69,7 @@ flying_pigs1 <- tribble(
"10.4", "2.53",
"7.3", "3.14"
) %>%
- mutate(n = 25)
+ dplyr::mutate(n = 25)
```
Use RStudio's multiple cursors to draw quotation marks around all the `x` and `sd` values, and to set commas at the end. See `vignette("wrangling")`, section *With copy and paste*, if you are not sure how to do that.
@@ -95,7 +91,7 @@ The `reason` column says why a set of values was inconsistent. To be GRIMMER-con
If a mean is composed of multiple items, set the `items` parameter to that number. Below are hypothetical means of a three-items scale. With the single-item default, half of these are wrongly flagged as inconsistent:
```{r, error=TRUE}
-jpap_1 <- tribble(
+jpap_1 <- tibble::tribble(
~x, ~sd,
"5.90", "2.19",
"5.71", "1.42",
@@ -104,7 +100,7 @@ jpap_1 <- tribble(
"4.61", "1.92",
"5.24", "2.51",
) %>%
- mutate(n = 40)
+ dplyr::mutate(n = 40)
jpap_1 %>%
grimmer_map() # default is wrong here!
@@ -120,7 +116,7 @@ jpap_1 %>%
It is also possible to include an `items` column in the data frame instead:
```{r, error=TRUE}
-jpap_2 <- tribble(
+jpap_2 <- tibble::tribble(
~x, ~sd, ~items,
"6.92", "2.19", 1,
"3.48", "1.42", 1,
@@ -129,7 +125,7 @@ jpap_2 <- tribble(
"4.04", "1.92", 3,
"4.50", "2.51", 3,
) %>%
- mutate(n = 30)
+ dplyr::mutate(n = 30)
jpap_2 %>%
grimmer_map()
@@ -180,7 +176,7 @@ These columns are ---
GRIMMER does not currently have a dedicated visualization function in scrutiny. However, `grim_plot()` will accept the output of `grimmer_map()` just as well as that from `grim_map()`:
```{r, fig.width=6, fig.height=5.5}
-jpap_5 <- tribble(
+jpap_5 <- tibble::tribble(
~x, ~sd, ~n,
"7.19", "1.19", 54,
"4.56", "2.56", 66,
diff --git a/vignettes/infrastructure.Rmd b/vignettes/infrastructure.Rmd
index 24bbc477..68ef3003 100644
--- a/vignettes/infrastructure.Rmd
+++ b/vignettes/infrastructure.Rmd
@@ -5,7 +5,6 @@ vignette: >
%\VignetteIndexEntry{General infrastructure}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
- %\VignetteDepends{devtools}
bibliography: references.bib
---
@@ -16,10 +15,6 @@ knitr::opts_chunk$set(
)
```
-```{r include=FALSE}
-# Dev only: load scrutiny from within scrutiny
-devtools::load_all(".")
-```
```{r setup, message=FALSE}
library(scrutiny)
diff --git a/vignettes/rounding.Rmd b/vignettes/rounding.Rmd
index 42e67cc9..6b2aec88 100644
--- a/vignettes/rounding.Rmd
+++ b/vignettes/rounding.Rmd
@@ -14,11 +14,6 @@ knitr::opts_chunk$set(
)
```
-```{r include=FALSE}
-# Dev only: load scrutiny from within scrutiny
-devtools::load_all(".")
-```
-
```{r setup, message=FALSE}
library(scrutiny)
```
diff --git a/vignettes/wrangling.Rmd b/vignettes/wrangling.Rmd
index 97751555..3867b791 100644
--- a/vignettes/wrangling.Rmd
+++ b/vignettes/wrangling.Rmd
@@ -5,7 +5,6 @@ vignette: >
%\VignetteIndexEntry{Data wrangling}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
- %\VignetteDepends{devtools}
---
```{r, include = FALSE}
@@ -15,11 +14,6 @@ knitr::opts_chunk$set(
)
```
-```{r include=FALSE}
-# Dev only: load scrutiny from within scrutiny
-devtools::load_all(".")
-```
-
```{r setup, message=FALSE}
library(scrutiny)
```
@@ -60,7 +54,7 @@ Perhaps not all R users know that RStudio features an option for multiple cursor
You should then get something like this:
```{r}
-flights1 <- tribble(
+flights1 <- tibble::tribble(
~x,
"8.97",
"2.61",
@@ -76,7 +70,7 @@ All that's missing is the sample size. Add it either via another `tribble()` col
```{r}
flights1 <- flights1 %>%
- mutate(n = 28)
+ dplyr::mutate(n = 28)
flights1
```
@@ -117,7 +111,7 @@ vec %>%
A convenient way to restore trailing zeros in a data frame is `restore_zeros_df()`. By default, it operates on all columns that are coercible to numeric (factors don't count):
```{r}
-iris <- as_tibble(iris)
+iris <- tibble::as_tibble(iris)
iris %>%
restore_zeros_df(width = 3)
```
@@ -136,7 +130,7 @@ iris %>%
With summary data copied or extracted from PDF (see above), you might encounter values presented like `5.22 (0.73)`. Instead of manually teasing them apart, call `split_by_parens()`:
```{r}
-flights2 <- tribble(
+flights2 <- tibble::tribble(
~drone, ~selfpilot,
"0.09 (0.21)", "0.19 (0.13)",
"0.19 (0.28)", "0.53 (0.10)",