Skip to contents

Discoverability helper for finding assay names to pass to assay(), write_nifti_assays(), or write_out() without having to run a job and inspect names(assays(fit)). Works on a realised gds, a lazy gds_plan/gds_source (reporting the input assays the source probed), or—when reducer is supplied—reports a reducer's declared output stems without computing anything.

Usage

list_assays(x, reducer = NULL, info = TRUE)

Arguments

x

A realised gds, a gds_plan, or a gds_source.

reducer

Optional reducer name (e.g. "meta:re", "ols:voxelwise", or an alias like "random"). When supplied, x is ignored and the reducer's declared provides stems are returned. Regression/LMM reducers expand coef/se_coef/z_coef/t_coef/p_coef into per-term coef:<term> etc. at compute time, so realised names depend on the model formula.

info

Logical; if TRUE (default) return a data frame with assay, role, and units columns (from assay_info() where registered, else NA); if FALSE return a plain character vector of names.

Value

A data frame (or a character vector when info = FALSE).

Examples

beta <- array(rnorm(5 * 4), c(5, 4, 1))
var <- array(1, c(5, 4, 1))
g <- new_gds(list(beta = beta, var = var), space_sample_labels(letters[1:5]),
             subjects = paste0("s", 1:4), contrasts = "c1")

fit <- one_sample(g) |> compute()
list_assays(fit)                       # names + roles of computed assays
#>                 assay role units
#> 1              sigma2 <NA>  <NA>
#> 2              df_res <NA>  <NA>
#> 3               n_obs <NA>  <NA>
#> 4             cov_tri <NA>  <NA>
#> 5    coef:(Intercept) <NA>  <NA>
#> 6 se_coef:(Intercept) <NA>  <NA>
#> 7  t_coef:(Intercept) <NA>  <NA>
#> 8  p_coef:(Intercept) <NA>  <NA>
list_assays(reducer = "meta:re")       # what random-effects would produce
#>    assay  role units
#> 1 beta_g  <NA>  <NA>
#> 2  var_g  <NA>  <NA>
#> 3   se_g  <NA>  <NA>
#> 4    z_g  <NA>  <NA>
#> 5    p_g  <NA>  <NA>
#> 6   tau2  <NA>  <NA>
#> 7      Q  <NA>  <NA>
#> 8     I2  <NA>  <NA>
#> 9  n_eff n_eff  <NA>