View source: R/colorSpec.ops.R
bind | R Documentation |
Take a sequence of colorSpec objects and combine their spectra
## S3 method for class 'colorSpec'
bind( ... )
... |
colorSpec objects with the same |
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 NA
s, analogous to
rbind.fill()
.
The metadata
of the returned object is copied from the first object in the input list.
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.
wavelength
,
quantity
,
specnames
,
organization
,
extradata
,
metadata
,
rbind.fill()
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.