Skip to contents

Constructs a concatenated collection mapping

Usage

bm_collect(mappers, hidden = FALSE)

bru_mapper_collect(...)

# S3 method for class 'bm_collect'
x[i, drop = TRUE]

# S3 method for class 'bru_mapper_collect'
x[i, drop = TRUE]

Arguments

mappers

A list of bru_mapper objects

hidden

logical, set to TRUE to flag that the mapper is to be used as a first level input mapper for INLA::f() in a model that requires making only the first mapper visible to INLA::f() and INLA::inla.stack(), such as for "bym2" models, as activated by the inla_f argument to ibm_n, ibm_values, and ibm_jacobian. Set to FALSE to always access the full mapper, e.g. for rgeneric models

...

Arguments passed on to bm_scale()

x

object from which to extract element(s)

i

indices specifying element(s) to extract

drop

logical; For [.bm_collect, whether to extract an individual mapper when i identifies a single element. If FALSE, a list of sub-mappers is returned (suitable e.g. for creating a new bm_collect object). Default: TRUE

Value

  • [-indexing a bm_collect extracts a subset bm_collect object (for drop FALSE) or an individual sub-mapper (for drop TRUE, and i identifies a single element)

Examples

(m <- bm_collect(list(
  a = bm_index(2),
  b = bm_index(3)
), hidden = FALSE))
#> collect(a = index, b = index)
ibm_eval2(m, list(a = c(1, 2), b = c(1, 3, 2)), 1:5)
#> $offset
#> [1] 1 2 3 5 4
#> 
#> $jacobian
#> 5 x 5 sparse Matrix of class "dgTMatrix"
#>               
#> [1,] 1 . . . .
#> [2,] . 1 . . .
#> [3,] . . 1 . .
#> [4,] . . . . 1
#> [5,] . . . 1 .
#>