knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = FALSE )
This vignette provides technical documentation for developers who want to maintain, extend, or contribute to the sprtt package.
It explains the internal architecture, code organization, computational methods, and development workflows.
Target audience: R package developers, future maintainers, and contributors
Prerequisite knowledge:
vignette("sprt")The sprtt package follows a modular architecture with clear separation of concerns:
Main User-facing functions (seq_ttest(), seq_anova()) handle input validation and provide clean interfaces
Utility User-facing functions provide supporting functionality (plotting, data generation, caching)
Builder functions (build_seq_*_arguments()) Transform and validate user inputs into a structured S4 argument object. Builder functions act as a processing pipeline between the user-facing interface and the core calculation functions. They handle the complex task of parsing different input formats, validating all parameters, and packaging everything into a type-safe container.
Calculation functions (calc_seq_*()) perform the core computations
Internal utility functions (e.g., delete_na(), extract_formula(), get_seq_decision(), ...) are small, focused helpers that handle specific tasks across the package. They follow the Single Responsibility Principle - each function does one thing well. This design reduces code duplication, improves testability, and makes the codebase easier to maintain.
Result Classes - S4 classes that store results in type-safe, structured containers. These classes provide controlled access to result components through standardized methods (@, [], and show()), ensuring consistency and extensibility.
This separation allows for:
Function Naming Convention:
seq_*(): User-facing main functionsbuild_*(): Argument preparation functions calc_*(): Computational core functions*_class.R: S4 class definitionsTable: Structure of the main seq_ttest() function (Level 1)
| Level 2 | Level 3 | Level 4 |
|:---------------------------------|:---------------------------------------------|:----------------------|
| build_seq_ttest_arguments()
Class: seq_ttest_arguments | check_formula() | |
| | extract_formula() | |
| | get_one_sample() | |
| | delete_na() | |
| | check_data() | check_constant_data() |
| calc_seq_ttest()
Class: seq_ttest_results | calc_seq_ttest_t_statistic() | |
| | calc_seq_ttest_non_centrality_parameter() | |
| | calc_seq_ttest_likelihoods() | |
| | calc_seq_ttest_boundaries() | |
| | get_seq_ttest_decision() | |
| | build_seq_ttest_results() | |
Table: Structure of the main seq_anova() function (Level 1)
| Level 2 | Level 3 |
|:---------------------------------|:---------------------------------------------|
| build_seq_anova_arguments()
Class: seq_anova_arguments | check_formula_anova()|
| | extract_formula_anova() |
| | check_data_anova() |
| calc_seq_anova()
Class: seq_anova_results | calc_non_centrality_parameter_anova()|
| | calc_group_means() |
| | calc_ss_effect() |
| | calc_ss_residual() |
| | calc_ss_total() |
| | calc_F_statistic_() |
| | calc_likelihoods_anova() |
| | calc_boundaries() |
| | get_seq_decision() |
| | calc_effect_sizes() |
| | build_seq_anova_results() |
| calc_plot_anova()
Class: seq_anova_results | |
devtools::check() - must pass cleanlydevtools::document()devtools::build_vignettes()covr::package_coverage()devtools::release()pkgdown::build_site()How to contribute:
Contribution guidelines:
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.