Merge a hyperSpec object and a data frame.

# S4 method for hyperSpec,data.frame
merge(x, y, ...)

Arguments

x

a hyperSpec object

y

a data.frame object

...

handed to merge.data.frame

Value

A hyperSpec object, with updated slot @data.

See also

merge, merge.

collapse combines hyperSpec objects that do not share the wavelength axis. rbind, and cbind for combining hyperSpec objects that.

Author

V. Gegzna

Examples


merge(chondro [1:10,, 600], chondro[5:15,, 600]$.., by = c("x", "y"))$.
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'merge': object 'chondro' not found
tmp <- merge (chondro [1:10,, 610], chondro [5:15,, 610]$..,
              by = c("x", "y"), all = TRUE)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'merge': object 'chondro' not found
tmp$.
#> Error in eval(expr, envir, enclos): object 'tmp' not found
wl (tmp)
#> Error in is_hyperSpec(object): object 'tmp' not found

## remove duplicated wavelengths:
approxfun <- function (y, wl, new.wl){
  approx (wl, y, new.wl, method = "constant",
          ties = function (x) mean (x, na.rm = TRUE)
          )$y
}

merged <- merge (chondro [1:7,, 610 ~ 620], chondro [5:10,, 615 ~ 625], all = TRUE)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'merge': object 'chondro' not found
merged$.
#> Error in eval(expr, envir, enclos): object 'merged' not found
merged <- apply (merged, 1, approxfun,
                 wl = wl (merged), new.wl = unique (wl (merged)),
                 new.wavelength = "new.wl")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'X' in selecting a method for function 'apply': object 'merged' not found
merged$.
#> Error in eval(expr, envir, enclos): object 'merged' not found