calculateDistance {mia} | R Documentation

## Calculate sample distances with `vegan`

### Description

Will be removed by Bioc 3.15

### Usage

    calculateDistance(x, FUN = stats::dist, ...)

    ## S4 method for signature 'ANY'
    calculateDistance(x, FUN = stats::dist, ...)

    ## S4 method for signature 'SummarizedExperiment'
    calculateDistance(
      x,
      FUN = stats::dist,
      abund_values = exprs_values,
      exprs_values = "counts",
      transposed = FALSE,
      ...
    )

### Arguments

`x` | a `SummarizedExperiment` object containing a tree.
`FUN` | a `function` for distance calculation. The function must expect the input matrix as its first argument. With rows as samples and columns as features.
`...` | other arguments passed onto `FUN`
`abund_values` | a single `character` value for specifying which assay to use for calculation.
`exprs_values` | a single `character` value for specifying which assay to use for calculation. (Use `abund_values` instead. `exprs_values` will be disabled.)
`transposed` | Logical scalar, is x transposed with cells in rows?

### Details

`calculateDistance` calculates a distance matrix between samples. The type of distance calculated can be modified by setting `FUN`, which expects a function with a matrix input as its first argument.

### Value

a sample-by-sample distance matrix, suitable for NMDS, etc.

### Examples

    # generate some example data
    mat <- matrix(1:60, nrow = 6)
    df <- DataFrame(n = c(1:6))
    se <- SummarizedExperiment(assays = list(counts = mat),
                               rowData = df)
    ## Not run:
    calculateDistance(se)

    ## End(Not run)

[Package mia version 1.2.7 Index]