SpatialSpectraDataFrame: Constructor for the SpatialSpectraDataFrame class.

Description Usage Arguments Value Author(s) See Also Examples

Description

Constructor for the SpatialSpectraDataFrame class. Creates a SpatialSpectraDataFrame object from scratch.

Usage

1
SpatialSpectraDataFrame(coords, nir, data, coords.nrs = numeric(0), proj4string = CRS(as.character(NA)), match.ID = TRUE, bbox=NULL, wl=numeric(), id=data.frame(id=NA), units="nm")

Arguments

wl

a numeric vector giving the wavelengths at with the spectra have been measured

nir

a "matrix" or a "data.frame" object giving the spectra values for each sample

id

a vector giving the unique id of each sample in the collection

units

a character giving the unit in which the wavelengths values are expressed

data

object of class "data.frame" containing the attribute data

coords

numeric matrix or data.frame with coordinates (each row is a point)

proj4string

projection string of class CRS-class

bbox

bounding box matrix, usually NULL and constructed from the data, but may be passed through for coercion purposes if clearly needed

coords.nrs

numeric; if present, records the column positions where in data the coordinates were taken from (used by coordinates<-)

match.ID

logical; if TRUE AND coords has rownames (i.e., coerced to a matrix, dimnames(coords)[[2]] is not NULL), AND data has row.names (i.e. is a data.frame), then the SpatialSpectraDataFrame object is formed by matching the row names of both components, leaving the order of the coordinates in tact. Checks are done to see whether both row names are sufficiently unique, and all data are matched. If FALSE, coordinates and data are simply "glued" together. If character: indicates the column in data with coordinates IDs to match

Value

a new "SpatialSpectraDataFrame" object

Author(s)

Pierre Roudier pierre.roudier@gmail.com

See Also

spectra, wl, SpatialSpectraDataFrame-class

Examples

1
2
3
4
5
6
7
8
  # Creating a SpatialSpectraDataFrame object from scratch
  my.wl <- 350:2500
  my.id <- LETTERS[1:4]
  my.nir <- matrix(runif(4*length(my.wl)), nrow=4)
  my.data <- data.frame(foo = runif(4), bar = LETTERS[1:4])
  my.coords <- matrix(runif(4), runif(4), ncol=2, nrow=4)

  my.ssdf <- SpatialSpectraDataFrame(wl = my.wl, nir = my.nir, id = my.id, data = my.data, coords = my.coords)

inspectr documentation built on May 2, 2019, 5:45 p.m.