subtractFromLocation {ClassifyR} | R Documentation

## Subtract Numeric Feature Measurements from a Location

### Description

For each numeric feature, calculates the location, and subtracts all measurements from that location.

### Usage

      ## S4 method for signature 'matrix'
    subtractFromLocation(measurements, training, location = c("mean", "median"),
                         absolute = TRUE, verbose = 3)
      ## S4 method for signature 'DataFrame'
    subtractFromLocation(measurements, training, location = c("mean", "median"),
                         absolute = TRUE, verbose = 3)
      ## S4 method for signature 'MultiAssayExperiment'
    subtractFromLocation(measurements, training, targets = names(measurements),
                               location = c("mean", "median"), absolute = TRUE, verbose = 3)

### Arguments

`measurements` | A `matrix`, `DataFrame` or a `MultiAssayExperiment` object containing the data. For a matrix, the rows are for features and the columns are for samples.
`training` | A vector specifying which samples are in the training set.
`location` | Character. Either "mean" or "median".
`absolute` | Logical. Default: `TRUE`. If `TRUE`, then absolute values of the differences are returned. Otherwise, they are signed.
`targets` | If `measurements` is a `MultiAssayExperiment`, the names of the data tables to be used. `"clinical"` is also a valid value and specifies that numeric variables from the clinical data table will be used.
`verbose` | Default: 3. A progress message is shown if this value is 3.

### Details

Only the samples specified by `training` are used in the calculation of the location. To use all samples for calculation of the location, simply provide indices of all the samples.

### Value

The same class of variable as the input variable `measurements` is, with the numeric features subtracted from the calculated location.

### Author(s)

Dario Strbenac

### Examples

      aMatrix <- matrix(1:100, ncol = 10)
      subtractFromLocation(aMatrix, training = 1:5, "median")

[Package ClassifyR version 2.14.0 Index]