bind: Combine colorSpec Objects

Description Usage Arguments Details Value See Also Examples

Description

Take a sequence of colorSpec objects and combine their spectra

Usage

1
2
## S3 method for class 'colorSpec'
bind( ... )

Arguments

...

colorSpec objects with the same wavelength and quantity, and with distinct specnames (no duplicates)

Details

The organization of the returned object is the most complex of those in the inputs, where the order of complexity is:

'matrix' < 'df.col' < 'df.row'

If the selected organization is 'df.row' the extradata is combined in a way that preserves all the columns. Missing data is filled with NAs, analogous to plyr::rbind.fill().

The metadata of the returned object is copied from the first object in the input list.

Value

bind() returns a colorSpec object, or NULL in case of ERROR. If the bind is successful, the number of spectra in the output object is the sum of the number of spectra in the input objects.

See Also

wavelength, quantity, specnames, organization, extradata, metadata, rbind.fill

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Rosco = readSpectra( system.file( 'extdata/objects/Rosco.txt', package='colorSpec' ) )
Rosco = resample( Rosco, wave=wavelength(Hoya) )
numSpectra(Hoya)        # prints 4
numSpectra(Rosco)       # prints 42

filters = bind( Hoya, Rosco )
numSpectra(filters)     # prints 46

colnames( extradata(Hoya) )
## [1] "SAMPLE_NAME"  "FresnelReflectance"  "Thickness"

colnames( extradata(Rosco) )
## [1] "Model"  "SampleID"  "SAMPLE_NAME"  "Substrate"  "RefractiveIndex"  "Thickness"

##  The columns in common are "SAMPLE_NAME" and "Thickness"


colnames( extradata(filters) )
## [1] "FresnelReflectance" "Model" "RefractiveIndex" "SAMPLE_NAME"
## [5] "SampleID" "Substrate" "Thickness"
##
## "SAMPLE_NAME" and "Thickness" are combined in the usual way
## The other columns are present, and missing data is filled with NAs

colorSpec documentation built on June 24, 2019, 9:03 a.m.