R: A Logical Map

LogMap-class {SeuratObject} | R Documentation

## A Logical Map

### Description

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 `[[<-`

### Usage

    LogMap(y)

    ## S4 method for signature 'LogMap,character,missing'
    x[[i, j, ...]]

    ## S4 method for signature 'LogMap,missing,missing'
    x[[i, j, ...]]

    ## S4 method for signature 'LogMap,'NULL',missing'
    x[[i, j, ...]]

    ## S4 replacement method for signature 'LogMap,character,missing,character'
    x[[i, j, ...]] <- value

    ## S4 replacement method for signature 'LogMap,character,missing,integer'
    x[[i, j, ...]] <- value

    ## S4 replacement method for signature 'LogMap,character,missing,'NULL''
    x[[i, j, ...]] <- value

    ## S4 replacement method for signature 'LogMap,character,missing,numeric'
    x[[i, j, ...]] <- value

    ## S4 method for signature 'LogMap'
    show(object)

### Arguments

`y` | A character vector
`x, object` | A `LogMap` object
`i` | A character vector of length 1, or `NULL`
`j` | Not used
`...` | Ignored
`value` | A character or integer vector of values to record in the map for `i`, or `NULL` to remove the record for `i`

### Value

`LogMap`: 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`

### Slots

`.Data`

  A logical matrix with at least one row

### Examples

    # Create a LogMap
    map <- LogMap(letters[1:10])
    map

    # Get the names of values in the LogMap
    map[[NULL]]
    rownames(map)

    # Add an observation to the LogMap
    map[['obs']] <- c(1, 3, 7)
    map

    # Get the names of observations in the LogMap
    colnames(map)

    # Fetch an observation from the LogMap
    map[['obs']]

    # Get the full logical matrix
    map[[]]

    # Remove an observation from the LogMap
    map[['obs']] <- NULL
    map

[Package SeuratObject version 4.1.0 Index]