Learn R Programming

spectrolab (version 0.0.18)

quantile.spectra: Compute spectra quantiles

Description

quantile computes quantiles by band and returns them as `spectra`.

Usage

# S3 method for spectra
quantile(
  x,
  probs = c(0.025, 0.25, 0.5, 0.75, 0.975),
  na.rm = TRUE,
  names = NULL,
  ...
)

Value

spectra object with one spectrum for each prob

Arguments

x

spectra object. Must have at least the same number of sample that length(probs) has.

probs

Probabilities to compute quantiles. Must be a vector of numerics between 0.0 and 1.0. Defaults to c(0.025, 0.25, 0.5, 0.75, 0.975). Duplicated probs will be removed.

na.rm

remove NAs before computing quantiles? Defaults to TRUE

names

names for each quantile spectrum. If NULL (default), names are set to `probs`. A char vector should otherwise be given. Recycled.

...

other arguments passed to quantile.

Author

Jose Eduardo Meireles

Examples

Run this code
library(spectrolab)
spec = as_spectra(spec_matrix_example, name_idx = 1)
quantile(spec, probs = c(0.25, 0.75))

Run the code above in your browser using DataLab