Learn R Programming

speccurvieR (version 1.0.0)

sca_tidiers: Tidy and glance methods for speccurvieR objects

Description

[generics::tidy()] and [generics::glance()] methods for the data frame returned by [sca()] (class `"sca"`) and the object returned by [sca_test()]. These are the same generics that `broom::tidy()` / `broom::glance()` and `modelsummary` dispatch on, so the results can feed those tools.

Note that the tidied column names follow the broom convention (`estimate` / `std.error` / `p.value`), which differs from the raw column names of [sca()] output (`coef` / `se` / `p`). For an `sca` curve every row shares the same focal `term`, so a tool that keys on `term` (such as `modelsummary`) needs each row distinguished (e.g. by `spec_id`); the per-statistic rows of `tidy.sca_test()` are already distinct. The `controls` column lists the model terms included (so an interaction control `a*b` appears as its expanded terms), which can differ from the user-facing control count in `glance()$n_controls`.

Usage

# S3 method for sca
tidy(x, ...)

# S3 method for sca glance(x, ...)

# S3 method for sca_test tidy(x, ...)

# S3 method for sca_test glance(x, ...)

# S3 method for sca_test as.data.frame( x, row.names = NULL, optional = FALSE, ..., what = c("summary", "null", "params", "specs") )

Value

A data frame. For `tidy()`, one row per specification (`sca`) or per test statistic (`sca_test`); for `glance()`, a one-row summary.

Arguments

x

An object returned by [sca()] (class `"sca"`) or by [sca_test()].

...

Ignored.

row.names, optional

Passed through from the [as.data.frame()] generic; ignored.

what

For `as.data.frame.sca_test()`, which component to return: `"summary"` (default; observed statistics and p-values), `"null"` (the raw null distribution), `"params"` (the run metadata), or `"specs"` (the per-specification family-wise-error-rate-adjusted p-values, available only when the result was computed with `keep_curves = TRUE` and a confound-preserving null; see [sca_minp()]).

See Also

[sca_table()] and [sca_report()] for formatted reporting.

Examples

Run this code
s <- sca(y = "Salnty", x = "T_degC", controls = c("ChlorA", "O2Sat"),
         data = bottles, progress_bar = FALSE, parallel = FALSE)
tidy(s)
glance(s)

Run the code above in your browser using DataLab