Skip to content
CRAN requires the check problems on this package to be fixed before Nov 14 or it will be archived. See the check details
steppedwedge needs insight (through performance), which CRAN will archive unless its check problems are fixed by Nov 14.

steppedwedge

1.0.0Package record

Analyze Data from Stepped Wedge Cluster Randomized Trials

0packages depend
2.3Kdownloads / year
56.0%test coverage
9/13flavors OK

Overview

About

Provide various functions and tools to help fit models for estimating treatment effects in stepped wedge cluster randomized trials. Implements methods described in Kenny, Voldal, Xia, and Heagerty (2022) "Analysis of stepped wedge cluster randomized trials in the presence of a time-varying treatment effect", doi:10.1002/sim.9511.

Install

Health

CRAN checks
4ERROR9OK
Check messages
ERRORexamplesr-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-release-linux-x86_64

r-devel-linux-x86_64-debian-gcc, r-release-linux-x86_64

Running examples in ‘steppedwedge-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: analyze
> ### Title: Analyze a stepped wedge dataset
> ### Aliases: analyze
> 
> ### ** Examples
> 
> # Load data
> test_data <- load_data(time ="period", cluster_id = "cluster", individual_id = NULL,
+ treatment = "trt", outcome = "outcome_cont", data = sw_data_example)
Stepped wedge dataset loaded. Discrete time design with 15 clusters, 5 sequences, and 6 time points.
> 
> # Analysis example 1: TATE estimand for exposure times 1 through 4
> results_tate <- analyze(dat = test_data, method = "mixed", estimand_type = "TATE",
+ estimand_time = c(1, 4), exp_time = "ETI")
Error in model.frame.default(data = dat, offset = offset, drop.unused.levels = TRUE,  : 
  invalid type (closure) for variable '(offset)'
Calls: analyze ... mkFormula -> eval -> eval -> <Anonymous> -> model.frame.default
Execution halted

r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc

Running examples in ‘steppedwedge-Ex.R’ failed
The error most likely occurred in:

> ### Name: analyze
> ### Title: Analyze a stepped wedge dataset
> ### Aliases: analyze
> 
> ### ** Examples
> 
> # Load data
> test_data <- load_data(time ="period", cluster_id = "cluster", individual_id = NULL,
+ treatment = "trt", outcome = "outcome_cont", data = sw_data_example)
Stepped wedge dataset loaded. Discrete time design with 15 clusters, 5 sequences, and 6 time points.
> 
> # Analysis example 1: TATE estimand for exposure times 1 through 4
> results_tate <- analyze(dat = test_data, method = "mixed", estimand_type = "TATE",
+ estimand_time = c(1, 4), exp_time = "ETI")
Error in model.frame.default(data = dat, offset = offset, drop.unused.levels = TRUE,  : 
  invalid type (closure) for variable '(offset)'
Calls: analyze ... mkFormula -> eval -> eval -> <Anonymous> -> model.frame.default
Execution halted
ERRORre-building of vignette outputsr-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-release-linux-x86_64

r-devel-linux-x86_64-debian-gcc, r-release-linux-x86_64

Error(s) in re-building vignettes:
  ...
--- re-building ‘steppedwedge.Rmd’ using rmarkdown

Quitting from steppedwedge.Rmd:62-73 [unnamed-chunk-5]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `model.frame.default()`:
! invalid type (closure) for variable '(offset)'
---
Backtrace:
     ▆
  1. └─steppedwedge::analyze(...)
  2.   ├─lme4::glmer(formula, family = family, data = dat, offset = offset)
  3.   │ └─base::eval(mc, parent.frame(1L))
  4.   │   └─base::eval(mc, parent.frame(1L))
  5.   ├─lme4::glFormula(...)
  6.   │ └─lme4:::mkFormula(...)
  7.   │   └─base::eval(mf, parent_env)
  8.   │     └─base::eval(mf, parent_env)
  9.   ├─stats::model.frame(...)
 10.   └─stats::model.frame.default(...)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: processing vignette 'steppedwedge.Rmd' failed with diagnostics:
invalid type (closure) for variable '(offset)'
--- failed re-building ‘steppedwedge.Rmd’

SUMMARY: processing the following file failed:
  ‘steppedwedge.Rmd’

Error: Vignette re-building failed.
Execution halted

r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc

Error(s) in re-building vignettes:
--- re-building ‘steppedwedge.Rmd’ using rmarkdown

Quitting from steppedwedge.Rmd:62-73 [unnamed-chunk-5]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `model.frame.default()`:
! invalid type (closure) for variable '(offset)'
---
Backtrace:
     ▆
  1. └─steppedwedge::analyze(...)
  2.   ├─lme4::glmer(formula, family = family, data = dat, offset = offset)
  3.   │ └─base::eval(mc, parent.frame(1L))
  4.   │   └─base::eval(mc, parent.frame(1L))
  5.   ├─lme4::glFormula(...)
  6.   │ └─lme4:::mkFormula(...)
  7.   │   └─base::eval(mf, parent_env)
  8.   │     └─base::eval(mf, parent_env)
  9.   ├─stats::model.frame(...)
 10.   └─stats::model.frame.default(...)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: processing vignette 'steppedwedge.Rmd' failed with diagnostics:
invalid type (closure) for variable '(offset)'
--- failed re-building ‘steppedwedge.Rmd’

SUMMARY: processing the following file failed:
  ‘steppedwedge.Rmd’

Error: Vignette re-building failed.
Execution halted
ERRORtestsr-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-release-linux-x86_64

r-devel-linux-x86_64-debian-gcc

Running ‘testthat.R’ [3s/4s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional test configuration?
  > # Learn more about the roles of various files in:
  > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
  > # * https://testthat.r-lib.org/articles/special-files.html
  > 
  > library(testthat)
  > library(steppedwedge)
  > 
  > test_check("steppedwedge")
  Stepped wedge dataset loaded. Discrete time design with 2 clusters, 2 sequences, and 3 time points.
  Saving _problems/test-analyze_data-33.R
  Saving _problems/test-analyze_data-40.R
  Saving _problems/test-analyze_data-47.R
  Saving _problems/test-analyze_data-78.R
  Saving _problems/test-analyze_data-88.R
  Stepped wedge dataset loaded. Discrete time design with 2 clusters, 2 sequences, and 3 time points.
  Stepped wedge dataset loaded. Discrete
...[truncated]...
└─base::eval(mf, parent_env)
    9.   ├─stats::model.frame(...)
   10.   └─stats::model.frame.default(...)
  ── Error ('test-analyze_data.R:87:3'): Function handles different family and link functions ──
  Error in `model.frame.default(data = dat, offset = offset, drop.unused.levels = TRUE, formula = outcome ~ factor(time) - 1 + treatment + (1 + cluster_id) + (1 + ij))`: invalid type (closure) for variable '(offset)'
  Backtrace:
       ▆
    1. └─steppedwedge::analyze(...) at test-analyze_data.R:87:3
    2.   ├─lme4::glmer(formula, family = family, data = dat, offset = offset)
    3.   │ └─base::eval(mc, parent.frame(1L))
    4.   │   └─base::eval(mc, parent.frame(1L))
    5.   ├─lme4::glFormula(...)
    6.   │ └─lme4:::mkFormula(...)
    7.   │   └─base::eval(mf, parent_env)
    8.   │     └─base::eval(mf, parent_env)
    9.   ├─stats::model.frame(...)
   10.   └─stats::model.frame.default(...)
  
  [ FAIL 5 | WARN 0 | SKIP 0 | PASS 24 ]
  Error:
  ! Test failures.
  Execution halted

r-devel-linux-x86_64-fedora-clang

Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional test configuration?
  > # Learn more about the roles of various files in:
  > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
  > # * https://testthat.r-lib.org/articles/special-files.html
  > 
  > library(testthat)
  > library(steppedwedge)
  > 
  > test_check("steppedwedge")
  Stepped wedge dataset loaded. Discrete time design with 2 clusters, 2 sequences, and 3 time points.
  Saving _problems/test-analyze_data-33.R
  Saving _problems/test-analyze_data-40.R
  Saving _problems/test-analyze_data-47.R
  Saving _problems/test-analyze_data-78.R
  Saving _problems/test-analyze_data-88.R
  Stepped wedge dataset loaded. Discrete time design with 2 clusters, 2 sequences, and 3 time points.
  Stepped wedge dataset loaded. Discrete time de
...[truncated]...
└─base::eval(mf, parent_env)
    9.   ├─stats::model.frame(...)
   10.   └─stats::model.frame.default(...)
  ── Error ('test-analyze_data.R:87:3'): Function handles different family and link functions ──
  Error in `model.frame.default(data = dat, offset = offset, drop.unused.levels = TRUE, formula = outcome ~ factor(time) - 1 + treatment + (1 + cluster_id) + (1 + ij))`: invalid type (closure) for variable '(offset)'
  Backtrace:
       ▆
    1. └─steppedwedge::analyze(...) at test-analyze_data.R:87:3
    2.   ├─lme4::glmer(formula, family = family, data = dat, offset = offset)
    3.   │ └─base::eval(mc, parent.frame(1L))
    4.   │   └─base::eval(mc, parent.frame(1L))
    5.   ├─lme4::glFormula(...)
    6.   │ └─lme4:::mkFormula(...)
    7.   │   └─base::eval(mf, parent_env)
    8.   │     └─base::eval(mf, parent_env)
    9.   ├─stats::model.frame(...)
   10.   └─stats::model.frame.default(...)
  
  [ FAIL 5 | WARN 0 | SKIP 0 | PASS 24 ]
  Error:
  ! Test failures.
  Execution halted

r-devel-linux-x86_64-fedora-gcc

Running ‘testthat.R’ [4s/11s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional test configuration?
  > # Learn more about the roles of various files in:
  > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
  > # * https://testthat.r-lib.org/articles/special-files.html
  > 
  > library(testthat)
  > library(steppedwedge)
  > 
  > test_check("steppedwedge")
  Stepped wedge dataset loaded. Discrete time design with 2 clusters, 2 sequences, and 3 time points.
  Saving _problems/test-analyze_data-33.R
  Saving _problems/test-analyze_data-40.R
  Saving _problems/test-analyze_data-47.R
  Saving _problems/test-analyze_data-78.R
  Saving _problems/test-analyze_data-88.R
  Stepped wedge dataset loaded. Discrete time design with 2 clusters, 2 sequences, and 3 time points.
  Stepped wedge dataset loaded. Discret
...[truncated]...
└─base::eval(mf, parent_env)
    9.   ├─stats::model.frame(...)
   10.   └─stats::model.frame.default(...)
  ── Error ('test-analyze_data.R:87:3'): Function handles different family and link functions ──
  Error in `model.frame.default(data = dat, offset = offset, drop.unused.levels = TRUE, formula = outcome ~ factor(time) - 1 + treatment + (1 + cluster_id) + (1 + ij))`: invalid type (closure) for variable '(offset)'
  Backtrace:
       ▆
    1. └─steppedwedge::analyze(...) at test-analyze_data.R:87:3
    2.   ├─lme4::glmer(formula, family = family, data = dat, offset = offset)
    3.   │ └─base::eval(mc, parent.frame(1L))
    4.   │   └─base::eval(mc, parent.frame(1L))
    5.   ├─lme4::glFormula(...)
    6.   │ └─lme4:::mkFormula(...)
    7.   │   └─base::eval(mf, parent_env)
    8.   │     └─base::eval(mf, parent_env)
    9.   ├─stats::model.frame(...)
   10.   └─stats::model.frame.default(...)
  
  [ FAIL 5 | WARN 0 | SKIP 0 | PASS 24 ]
  Error:
  ! Test failures.
  Execution halted

r-release-linux-x86_64

Running ‘testthat.R’ [5s/9s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional test configuration?
  > # Learn more about the roles of various files in:
  > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
  > # * https://testthat.r-lib.org/articles/special-files.html
  > 
  > library(testthat)
  > library(steppedwedge)
  > 
  > test_check("steppedwedge")
  Stepped wedge dataset loaded. Discrete time design with 2 clusters, 2 sequences, and 3 time points.
  Saving _problems/test-analyze_data-33.R
  Saving _problems/test-analyze_data-40.R
  Saving _problems/test-analyze_data-47.R
  Saving _problems/test-analyze_data-78.R
  Saving _problems/test-analyze_data-88.R
  Stepped wedge dataset loaded. Discrete time design with 2 clusters, 2 sequences, and 3 time points.
  Stepped wedge dataset loaded. Discrete
...[truncated]...
└─base::eval(mf, parent_env)
    9.   ├─stats::model.frame(...)
   10.   └─stats::model.frame.default(...)
  ── Error ('test-analyze_data.R:87:3'): Function handles different family and link functions ──
  Error in `model.frame.default(data = dat, offset = offset, drop.unused.levels = TRUE, formula = outcome ~ factor(time) - 1 + treatment + (1 + cluster_id) + (1 + ij))`: invalid type (closure) for variable '(offset)'
  Backtrace:
       ▆
    1. └─steppedwedge::analyze(...) at test-analyze_data.R:87:3
    2.   ├─lme4::glmer(formula, family = family, data = dat, offset = offset)
    3.   │ └─base::eval(mc, parent.frame(1L))
    4.   │   └─base::eval(mc, parent.frame(1L))
    5.   ├─lme4::glFormula(...)
    6.   │ └─lme4:::mkFormula(...)
    7.   │   └─base::eval(mf, parent_env)
    8.   │     └─base::eval(mf, parent_env)
    9.   ├─stats::model.frame(...)
   10.   └─stats::model.frame.default(...)
  
  [ FAIL 5 | WARN 0 | SKIP 0 | PASS 24 ]
  Error:
  ! Test failures.
  Execution halted

CRAN check page ↗

Slowest check: 1.7 min · r-oldrel-windows-x86_64
Status changes
  • ERROR9 OK, 4 ERRORNow
  • ERROR11 OK, 2 ERROR2026-10-24
  • OK13 OK2026-08-04
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK13 OK2026-07-23
  • ERROR12 OK, 1 ERROR2026-07-07
Show 3 earlier changesHide 3 earlier changes
  • OK13 OK2026-06-09
  • ERROR12 OK, 1 ERROR2026-06-08
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 1.0.0
READMEYes · 137 wordsVignettesYes · 1 · dynamicNEWSYes · 100% structured · mentions 1.0.0Citation fileNoWebsiteYes · pkgdown
Help pages
6 (1 internal)includes a package overview page
Examples that run
100%4 run in a plain check
Exported functions with examples
100%
Documented parameters
97%
Return-value docs
100%
Help pages citing references
0%

Downloads

2.3K
CRAN downloads in the past year
Rank #21,963 · ~6/day · ~189/mo
Daily download trend is not available in this view yet.
20230 days
61090 days
2.3K1 year
Compare downloads with other packages →
Also on78 r2u

Repository

3Stars
0Forks
5Open issues
0Open PRs
0Releases
278Commits
3Commit identities
License file reads as GPL-3.0 · 278 commits · Last activity 2026-08-14
Responsiveness
How these are sampled
PRs merged (all time)
not measured
Median days to close, 50 most recently updated closed issues
48
Median days to close, 50 most recently updated closed PRs
not measured

Issues over time

2026-07-14 · 42026-10-21 · 5
PracticesBeta

10 development-tooling and community-health practices detected across 6 families in the upstream repository

Checks run against github.com/avi-kenny/steppedwedge on 2026-10-21.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (3)
pkgdown

GitHub Pages site last deployed 2026-08-14 · The repository has a site deploy workflow

pkgdown site last built 2026-08-14

Coverage (1)
Coverage reporting
Reproducibility and dev environment (1)
data-raw/
Show all practicesHide 2 practices
CRAN release process (2)
cran-comments.mdCRAN-SUBMISSION
Git structural (1)
.gitattributes
How this is detected·Detection ruleset v4 (2026-10-20)

Dependencies

Declared dependencies
11 external dependencies (excludes base and recommended)

Installing steppedwedge adds 45 packages (23 with compiled code, 45 MB of source tarballs). Heaviest: stringi 11 MB, ggplot2 6.0 MB, lme4 4.3 MB.

Depends (1)
R >= 2.10
LinkingTo (0)
none
Enhances (0)
none
Dependencies facing archival

CRAN will archive these unless their check problems are fixed by the date shown. This package needs each one to install.

Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

Datasets

People & History

People (3)
Author, Maintainer since 1.0.0 (2025), Copyright holder
Releases (1)
  • R
    R 4.6.0 released · 2026-04-24
  • R
    R 4.5.0 released · 2025-04-11
  • 1.0.0Latest
    2025-02-21 · current release
  • R
    R 4.4.0 released · 2024-04-24

Package metadata

First published
2025-02-21
Total releases
1 / 1 yrs
License
GPL-3 OSI
Minimum R
≥ 2.10
Bundled data
19 KB / 1 file
Download size
478 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("steppedwedge")
Kenny, A., Arthur, D., & Ouyang, Y. (2025). steppedwedge: Analyze Data from Stepped Wedge Cluster Randomized Trials (Version 1.0.0) [Computer software]. https://doi.org/10.32614/CRAN.package.steppedwedge

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for steppedwedge version 1.0.0 [Data set]. HJJB, LLC. Data release v2026-10-25. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy