spc.header2data: Copy header data into the @data slot

Description Usage Arguments Details Value Examples

Description

Get the header metadata and place it inside the @data slot

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
spc.header2data(object, headerfield, dataname, compress, ...)

## S4 method for signature 'Spectra'
spc.header2data(object, headerfield, dataname, compress = TRUE, ...)

## S4 method for signature 'list'
spc.header2data(object, headerfield, dataname, compress = TRUE, ...)

## S4 method for signature 'SpcList'
spc.header2data(object, headerfield, dataname, compress = TRUE, ...)

Arguments

object

A Spectra object

headerfield

character. Field name of the header to be copied.

dataname

character. Column name of @data slot to copy the incoming data.

compress

logical. Whether or not to compress data put into the header. See help of spc.data2header.

...

arguments to be passed to or from other methods

Details

If header element has length >1, its type is checked. If it is "character", its elements will be pasted using paste(...,collapse="|"). If it is another type, only the first element will be taken. For list and SpcList objects, the same procedure is repeated for all elements of the list containing Spectra objects. If dataname is missing, then it will be taken equal to headerfield.

Value

object of class Spectra or SpcList

Examples

1
2
3
4
sp <- spc.example_spectra()
sp <- spc.updateheader(sp,"Zone", "ZoneA")
sp <- spc.header2data(sp, "Zone")
sp$Zone

PranaGeo/Spectral documentation built on Feb. 21, 2020, 12:36 p.m.