A simple container for storing mappings of values using logical matrices.
Keeps track of which values (rows) are present in which observations
(columns). LogMap objects can be created with LogMap();
queries can be performed with [[ and observations can be added
or removed with [[<-
LogMap(y)
# S4 method for class 'LogMap,character,missing'
x[[i, j, ...]]
# S4 method for class 'LogMap,missing,missing'
x[[i, j, ...]]
# S4 method for class 'LogMap,NULL,missing'
x[[i, j, ...]]
# S4 method for class 'LogMap,character,missing,character'
x[[i, j, ...]] <- value
# S4 method for class 'LogMap,character,missing,integer'
x[[i, j, ...]] <- value
# S4 method for class 'LogMap,character,missing,NULL'
x[[i, j, ...]] <- value
# S4 method for class 'LogMap,character,missing,numeric'
x[[i, j, ...]] <- valueLogMap: A new LogMap object with zero columns and
length(x = x) rows; rownames are set to x
[[: if i is a character vector, the rownames that are
mapped to i; otherwise the rownames of x
[[<-: If value is NULL, then x without
the observations for i; otherwise, x with a new column for
i recording a TRUE for all values present in value
.DataA logical matrix with at least one row
Logical map objects, validity, and interaction methods:
LogMap-validity,
as.matrix.LogMap(),
droplevels.LogMap(),
intersect.LogMap(),
labels.LogMap()
# Create a LogMap
map <- LogMap(letters[1:10])
map
#> A logical map for 10 values across 0 observations
# Get the names of values in the LogMap
map[[NULL]]
#> [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"
rownames(map)
#> [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"
# Add an observation to the LogMap
map[['obs']] <- c(1, 3, 7)
map[['entry']] <- c(2, 7, 10)
map
#> A logical map for 10 values across 2 observations
# Get the names of observations in the LogMap
colnames(map)
#> [1] "obs" "entry"
# Fetch an observation from the LogMap
map[['obs']]
#> [1] "a" "c" "g"
# Get the full logical matrix
map[[]]
#> obs entry
#> a TRUE FALSE
#> b FALSE TRUE
#> c TRUE FALSE
#> d FALSE FALSE
#> e FALSE FALSE
#> f FALSE FALSE
#> g TRUE TRUE
#> h FALSE FALSE
#> i FALSE FALSE
#> j FALSE TRUE
# Remove an observation from the LogMap
map[['obs']] <- NULL
map[['entry']] <- NULL
map
#> A logical map for 10 values across 0 observations