Getter/setter methods {SingleCellExperiment} | R Documentation

## LinearEmbeddingMatrix getters/setters

### Description

Getter/setter methods for the LinearEmbeddingMatrix class.

### Usage

    ## S4 method for signature 'LinearEmbeddingMatrix'
    sampleFactors(x, withDimnames=TRUE)

    ## S4 replacement method for signature 'LinearEmbeddingMatrix'
    sampleFactors(x) <- value

    ## S4 method for signature 'LinearEmbeddingMatrix'
    featureLoadings(x, withDimnames=TRUE)

    ## S4 replacement method for signature 'LinearEmbeddingMatrix'
    featureLoadings(x) <- value

    ## S4 method for signature 'LinearEmbeddingMatrix'
    factorData(x)

    ## S4 replacement method for signature 'LinearEmbeddingMatrix'
    factorData(x) <- value

    ## S4 method for signature 'LinearEmbeddingMatrix'
    as.matrix(x, ...)

    ## S4 method for signature 'LinearEmbeddingMatrix'
    dim(x)

    ## S4 method for signature 'LinearEmbeddingMatrix'
    dimnames(x)

    ## S4 replacement method for signature 'LinearEmbeddingMatrix'
    dimnames(x) <- value

    ## S4 method for signature 'LinearEmbeddingMatrix'
    x$name

    ## S4 replacement method for signature 'LinearEmbeddingMatrix'
    x$name <- value

### Arguments

`x` | A LinearEmbeddingMatrix object.
`value` | An appropriate value to assign to the relevant slot.
`withDimnames` | A logical scalar indicating whether dimension names should be attached to the returned object.
`name` | A string specifying a field of the `factorData` slot.
`...` | Further arguments, ignored.

### Details

Any `value` to assign to `sampleFactors` and `featureLoadings` should be matrix-like objects, while `factorData` should be a DataFrame - ee LinearEmbeddingMatrix for details.

The `as.matrix` method will return the matrix of sample factors, consistent with the fact that the LinearEmbeddingMatrix mimics a sample-factor matrix. However, unlike the `sampleFactors` method, this is always guaranteed to return an ordinary R matrix, even if an alternative representation was stored in the slot. This ensures consistency with `as.matrix` methods for other matrix-like S4 classes.

For assignment to `dimnames`, a list of length 2 should be used containing vectors of row and column names.

### Value

For the getter methods `sampleFactors`, `featureLoadings` and `factorData`, the value of the slot with the same name is returned. For the corresponding setter methods, a LinearEmbeddingMatrix is returned with modifications to the named slot.

For `dim`, the dimensions of the `sampleFactors` slot are returned in an integer vector of length 2. For `dimnames`, a list of length 2 containing the row and column names is returned. For `as.matrix`, an ordinary matrix derived from `sampleFactors` is returned.

For `$`, the value of the named field of the `factorData` slot is returned. For `$<-`, a LinearEmbeddingMatrix is returned with the modified field in `factorData`.

### Author(s)

Keegan Korthauer, Davide Risso and Aaron Lun

### See Also

`LinearEmbeddingMatrix`

### Examples

    example(LinearEmbeddingMatrix, echo=FALSE) # Using the class example

    sampleFactors(lem)
    sampleFactors(lem) <- sampleFactors(lem) * -1

    featureLoadings(lem)
    featureLoadings(lem) <- featureLoadings(lem) * -1

    factorData(lem)
    factorData(lem)$whee <- 1

    nrow(lem)
    ncol(lem)
    colnames(lem) <- LETTERS[seq_len(ncol(lem))]
    as.matrix(lem)

[Package SingleCellExperiment version 1.6.0 Index]