GHRtools
  • Home
  • data4health
    • Overview
  • clim4health
    • Overview
  • GHRexplore
    • Overview
    • Reference
    • Changelog

    • Vignettes
    • Getting started
  • GHRmodel
    • Overview
    • Reference
    • Changelog

    • Vignettes
    • Getting started
    • Covariate structures
    • DLNMs in GHRmodel
  • GHRpredict
    • Overview
  • About GHR

On this page

  • Build Univariable Covariate Sets
    • Description
    • Arguments
    • Returns
    • Examples

Build Univariable Covariate Sets

Description

This function returns a list where each element contains a single covariate, based on covariates specified in the pattern or name arguments. This structure is suitable for generating separate univariable model formulas using write_inla_formulas.

cov_uni(covariates = NULL, pattern = NULL, name = NULL)

Arguments

  • covariates: A character vector of covariate names. Typically the output from extract_names.
  • pattern: A character vector specifying the prefix pattern(s) to match (e.g., “tmin” matches “tmin”, “tmin.l1”, etc.).
  • name: A character vector specifying exact variable name(s) to extract.

Returns

A list of character vectors, each of length 1, containing the matched covariate name. The resulting list is suitable for use as the covariates argument in write_inla_formulas.

Examples

data <- data.frame(tmin = rnorm(10), tmin.l1 = rnorm(10), urban = rnorm(10))
covs <- extract_names(data, pattern = "tmin", name = "urban")
cov_uni(covs, pattern = "tmin")
cov_uni(covs, name = "urban")

Copyright 2025, GHR