topLabels-methods {Cardinal} | R Documentation

## Retrieve Top-Ranked Labels from Analysis Results

### Description

The generic function is a convenience method for retrieving top-ranked labels from the results of imaging experiment analyses. For mass spectrometry-based imaging experiments, this can be used for identifying important masses from an analysis.

### Usage

    ## S4 method for signature 'ResultSet'
    topLabels(object, n = 6,
        model = pData(modelData(object)),
        type = c('+', '-', 'b'),
        sort.by = fvarLabels(object),
        filter = list(),
        ...)

    ## S4 method for signature 'PCA'
    topLabels(object, n = 6,
        sort.by = "loadings",
        ...)

    ## S4 method for signature 'PLS'
    topLabels(object, n = 6,
        sort.by = c("coefficients", "loadings", "weights"),
        ...)

    ## S4 method for signature 'OPLS'
    topLabels(object, n = 6,
        sort.by = c("coefficients",
                "loadings", "Oloadings",
                "weights", "Oweights"),
        ...)

    ## S4 method for signature 'SpatialKMeans'
    topLabels(object, n = 6,
        sort.by = c("betweenss", "withinss"),
        ...)

    ## S4 method for signature 'SpatialShrunkenCentroids'
    topLabels(object, n = 6,
        sort.by = c("tstatistics", "p.values"),
        ...)

    ## S4 method for signature 'CrossValidated'
    topLabels(object, ...)

### Arguments

`object` | A `ResultSet` derived object.
`n` | The number of top-ranked records to return.
`model` | If more than one model was fitted, results from which should be shown? Defaults to all models in the `ResultSet`. This can name the models explicitly or specify a list of parameter values.
`type` | How should the records be ranked? '+' shows greatest values first (decreasing order), '-' shows least values first (increasing order), and 'b' uses decreasing order based on absolute values.
`sort.by` | What variable should be used for sorting?
`filter` | A list of named variables with values to use to filter the results. For example, for testing or classification, this can be used to only show rankings for a particular condition.
`...` | Passed to the 'head' function when sorting the final list of results.

### Value

A `data.frame` with the top-ranked labels from the analysis.

### Author(s)

Kylie A. Bemis

### See Also

`ResultSet`, `PCA`, `PLS`, `OPLS`, `spatialKMeans`, `spatialShrunkenCentroids`

### Examples

    set.seed(1)
    data <- matrix(c(NA, NA, 1, 1, NA, NA, NA, NA, NA, NA, 1, 1, NA, NA,
        NA, NA, NA, NA, NA, 0, 1, 1, NA, NA, NA, NA, NA, 1, 0, 0, 1,
        1, NA, NA, NA, NA, NA, 0, 1, 1, 1, 1, NA, NA, NA, NA, 0, 1, 1,
        1, 1, 1, NA, NA, NA, NA, 1, 1, 1, 1, 1, 1, 1, NA, NA, NA, 1,
        1, NA, NA, NA, NA, NA, NA, 1, 1, NA, NA, NA, NA, NA), nrow=9, ncol=9)

    msset <- generateImage(data, range=c(200, 300), step=1, as="MSImageSet")

    clust1 <- spatialShrunkenCentroids(msset, r=c(1,2), k=c(2,3), s=c(0,1), method="gaussian")

    topLabels(clust1)

    topLabels(clust1, filter=list(classes=1))

    topLabels(clust1, filter=list(r=1, k=2, s=1))

[Package Cardinal version 1.12.1 Index]