Learn R Programming

speccurvieR (version 1.0.0)

sca_table: Render a specification curve result as a publication table

Description

`sca_table()` turns the output of [sca()] or [sca_test()] into a compact results block suitable for a manuscript: the number of specifications, the median estimate, the share of significant specifications, and (for [sca_test()]) the joint-inference statistics and their permutation p-values.

The default `format = "data.frame"` returns a small two-column (`label` / `value`) data frame with a `print` method and adds no dependencies. The other formats render that frame with an optional package: `"markdown"` / `"latex"` use `knitr`, and `"gt"`, `"kableExtra"`, and `"flextable"` use the package of the same name (install it first). A [tidy()]/[glance()]-aware tool such as `modelsummary` can consume the object directly without `sca_table()`.

Usage

sca_table(
  x,
  format = c("data.frame", "markdown", "latex", "gt", "kableExtra", "flextable"),
  digits = 3,
  ...
)

Value

For `format = "data.frame"`, a data frame of class `"sca_table"`; otherwise an object of the corresponding rendering package.

Arguments

x

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

format

The output format: one of `"data.frame"` (default), `"markdown"`, `"latex"`, `"gt"`, `"kableExtra"`, or `"flextable"`.

digits

Number of significant digits for estimates. Defaults to `3`.

...

Ignored.

See Also

[sca_report()] for a prose summary; [tidy()]/[glance()] for tidy data frames.

Examples

Run this code
s <- sca(y = "Salnty", x = "T_degC", controls = c("ChlorA", "O2Sat"),
         data = bottles, progress_bar = FALSE, parallel = FALSE)
sca_table(s)
# \donttest{
result <- sca_test(y = "Salnty", x = "T_degC", controls = c("ChlorA", "O2Sat"),
                   data = bottles, n_permutations = 50, seed = 1,
                   progress_bar = FALSE)
sca_table(result)
# }

Run the code above in your browser using DataLab