design: R4VN Study Design Studio

View source: R/design.R

designR Documentation

R4VN Study Design Studio

Description

Launch an interactive Shiny Studio for study-design guidance, sample-size planning, probability sampling, and random allocation. The working areas are independent: users may open any area directly and may optionally reuse or save results in one R4VN design project.

Usage

design(
  data = NULL,
  project_name = "Untitled Study",
  launch.browser = interactive(),
  port = NULL,
  host = "127.0.0.1"
)

Arguments

data

Optional data.frame used as the initial sampling/participant list.

project_name

Initial project name shown in the Studio.

launch.browser

Passed to shiny::runApp().

port

Optional port passed to shiny::runApp().

host

Host passed to shiny::runApp().

Details

design() contains four independent working areas:

Study Design

A guided cascade that recommends a design and explains why.

Sample Size

A searchable registry of formula-, precision-, power-, and model-based sample-size methods. Results include a formula or method rule, numerical substitution when available, calculation steps, adjustments, sensitivity analyses, references, and a Methods statement.

Sampling

Simple, systematic, stratified, PPS, cluster, and multistage sampling from an uploaded frame or, for methods that do not require frame variables, directly from generated IDs 1...N.

Randomization

Simple, complete, permuted-block, and stratified-block random allocation from a participant list or from generated participant numbers, with reproducibility metadata and printable allocation lists.

Word export uses rmarkdown/Pandoc so mathematical formulas are exported as formatted Word equations. PDF export prefers pagedown with Chrome and uses a LaTeX fallback when necessary. Excel templates/workbooks use openxlsx.

Advanced sample-size methods use method-specific packages when available, including presize, WebPower, statpsych, TrialSize, and pmsampsize. The Studio reports the method/reference used rather than silently replacing an unavailable advanced method with an unrelated approximation.

Value

Invisibly returns the Shiny app result when the app exits.

Examples

if (interactive()) {
  design()
}


R4VN documentation built on Sept. 30, 2026, 5:13 p.m.