hs_resample: Resampling function for hyperspec objects

Description Usage Arguments Value Examples

View source: R/hs_resample.R

Description

This function resamples the hyperspec object to an equal number of cells/spectra. Options are to resample with or withour replacement.

Usage

1
hs_resample(hs.x, sample = 0, replace = FALSE, seed = NULL)

Arguments

hs.x

hyperSpec object.

sample

Desired sample size. Defaults to minimum sample size.

replace

Do you want to resample with or without replacement? Defaults to FALSE, which is without replacement.

seed

Set seed for reproducibile sampling if that is necessary. Defaults to NULL.

Value

Hyperspec object

Examples

1
2
3
4
5
6
7
8
# Short example
data("hs_example")

# Preprocess
hs_example <- hs_preprocess(hs_example)

# Resample
hs_example_r <- hs_resample(hs_example, sample = 10, replace = TRUE)

CMET-UGent/MicroRaman documentation built on July 25, 2020, 6:20 p.m.