err_tdy_map_pos: Check and tidy 'map_pos'

Description Usage Arguments Details Value See Also Examples

View source: R/err_tdy.R

Description

Check and tidy map_pos, a mapping between positions along dimensions of array self and positions along dimensions of array oth. map_pos is a list the same length as dim_self. Each element of map_pos is a vector, showing, for each position on the dimension of self, which postition on the dimension of oth it maps on to. Multiple positions on self can map on to the same position on oth. If a position on self does not map to a position, on oth, the value for the non-mapping position is 0. If a dimension of self does not have a corresponding dimension in oth, then corresponding element of map_dim is vector of zeros.

Usage

1
err_tdy_map_pos(map_pos, dim_self, dim_oth, map_dim)

Arguments

map_pos

A list of integer vectors.

dim_self

The dimensions of self.

dim_oth

The dimensions of oth.

map_dim

A vector of non-negative integers.

Details

err_tdy_map_pos assumes that map_dim, dim_self, and dim_oth are all valid.

self and oth are both assumed to have positive length, ie no dimensions with length 0.

Value

map_pos, with elements coerced to integer.

See Also

err_tdy_map_dim

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
map_pos <- list(c(1L, 2L, 3L, 4L), c(0L, 1L), c(1L, 2L, 2L))
map_dim <- c(1L, 3L, 2L)
dim_self <- c(4L, 2L, 3L)
dim_oth <- c(4L, 2L, 1L)
err_tdy_map_pos(map_pos = map_pos,
                map_dim = map_dim,
                dim_self = dim_self,
                dim_oth = dim_oth)

map_pos <- list(c(2L, 1L), c(1L, 1L), c(0L, 0L, 0L))
map_dim <- c(1L, 2L, 0L)
dim_self <- c(2L, 2L, 3L)
dim_oth <- c(2L, 1L)
err_tdy_map_pos(map_pos = map_pos,
                map_dim = map_dim,
                dim_self = dim_self,
                dim_oth = dim_oth)

johnrbryant/demcheck documentation built on Dec. 31, 2021, 11:57 a.m.