bm_factor: Mapper for factor variables

View source: R/mappers.R

bm_factorR Documentation

Mapper for factor variables

Description

Create a factor mapper

Usage

bm_factor(values, factor_mapping, indexed = FALSE)

bru_mapper_factor(...)

Arguments

values

Input values calculated by bru_input.bru_input()

factor_mapping

character; selects the type of factor mapping.

  • 'contrast' for leaving out the first factor level.

  • 'full' for keeping all levels.

indexed

logical; if TRUE, the ibm_values() method will return an integer vector instead of the factor levels. This is needed e.g. for group and replicate mappers, since INLA::f() doesn't accept factor values. Default: FALSE, which works for the main input mappers. The default mapper constructions will set it the required setting.

...

Arguments passed on to bm_factor()

Value

A bm_factor mapper object.

See Also

bru_mapper, bru_mapper_generics

Other mappers: bm_aggregate(), bm_collect(), bm_const(), bm_expr(), bm_fm_mesh_1d, bm_fmesher(), bm_harmonics(), bm_index(), bm_linear(), bm_logitaverage(), bm_logsumexp(), bm_marginal(), bm_matrix(), bm_multi(), bm_pipe(), bm_reparam(), bm_repeat(), bm_scale(), bm_shift(), bm_sum(), bm_taylor(), bru_get_mapper(), bru_mapper()

Examples

m <- bm_factor(factor(c("a", "b")), "full")
ibm_eval2(m, input = c("b", "a", "a", "b"), state = c(1, 3))

m <- bm_factor(factor(c("a", "b")), "contrast")
ibm_eval2(m, input = factor(c("b", "a", "a", "b")), state = 2)


inlabru documentation built on July 28, 2026, 9:07 a.m.