Learn R Programming

spectacles (version 0.5-4)

separate: Separates a Spectra* object into a calibration and a validation set.

Description

Separates a Spectra* object into a calibration and a validation set.

Usage

# S4 method for Spectra
separate(obj, calibration)

Value

An list with two SpectraDataFrame objects, one for the calibration, and the other for the validation.

Arguments

obj

an object inheriting from class SpectraDataFrame

calibration

The fraction of the dataset to be put in the calibration set

Author

Pierre Roudier pierre.roudier@gmail.com

Examples

Run this code

# Loading example data
data(australia)
spectra(australia) <- sr_no ~ ... ~ 350:2500

l <- separate(australia, calibration=0.7)
# The result is a list of two Spectra* objects
str(l)
lapply(l, nrow)

Run the code above in your browser using DataLab