Skip to contents

Removes from a spectrum object the class attributes "generic_spct" and any derived class attribute such as "source_spct". This operation is done by reference!

Usage

rmDerivedSpct(x, keep.classes = NULL)

Arguments

x

an R object.

keep.classes

character vector Names of classes to keep. Can be used to retain base class "generic_spct".

Value

A character vector containing the removed class attribute values. This is different to the behaviour of function unlist in base R!

Details

This function alters x itself by reference. If x is not a generic_spct object, x is not modified. This function behaves similarly to setdiff() but preserving the original order of the character vector of the S3 class names.

Note

If x is an object of any of the spectral classes defined in this package, this function changes by reference the spectrum object into the underlying data.frame object. Otherwise, it just leaves x unchanged.

See also

Other set and unset spectral class functions: setGenericSpct()

Examples

my.spct <- sun.spct
removed <- rmDerivedSpct(my.spct)
removed
#> [1] "source_spct"  "generic_spct"
class(sun.spct)
#> [1] "source_spct"  "generic_spct" "tbl_df"       "tbl"          "data.frame"  
class(my.spct)
#> [1] "tbl_df"     "tbl"        "data.frame"