spc.data2header: Populate fields of header slot using data from data slot

Description Usage Arguments Details Value Examples

Description

Populates a field of @header with a column data from @data slot.

Usage

1
2
3
4
spc.data2header(object,dataname,headerfield,compress,...)

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

Arguments

object

A Spectra object.

dataname

A character object specifying the name of @data column to be used.

headerfield

A character object specifying the name of the @header field to be changed

compress

logical. Whether or not to compress data put into the header. See the description section.

...

arguments to be passed to or from other methods

Details

This function extracts data from a column of the @data slot (specified by dataname) and creates a new @header field with it. Ifa header field is not provided, the name of the new header field will be the same as dataname.

The name of the new header field can be overwritten by providing header field. If all the incoming data rows (dataname) are the same, information put into the header can be compressed by selecting compress=TRUE (default is FALSE). This would take only the first element from the @data column.

Value

object of class Spectra

Examples

1
2
3
4
5
6
7
8
sp=spc.example_spectra()
sp=spc.data2header(sp,"CAST")
sp@header
sp=spc.data2header(sp,"CAST","ProjectCast")
sp@header
sp$CAST=rep(33, nrow(sp))
sp=spc.data2header(sp,"CAST","ProjectCast", compress=TRUE)
sp@header

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