[!!!] Replace object$spc and colnames(object$spc)

replace_spc(object, x, ...)

Arguments

object

A hyperSpec object.

x

matrix with the new content for object@data$spc.

Its size must correspond to rows (for scores) and to either columns or rows (for loadings) of object.

...

further arguments to decomposition

Value

A hyperSpec object, updated according to x

Author

Vilmantas Gegzna

Examples


ratios <- colRatios(Scores2[[]])
obj1 <- replace_spc(Scores2, ratios)

colnames(obj1$spc)  # preserved
#>  [1] "k_308nm / k_419nm" "k_308nm / k_421nm" "k_308nm / k_495nm"
#>  [4] "k_308nm / k_582nm" "k_419nm / k_421nm" "k_419nm / k_495nm"
#>  [7] "k_419nm / k_582nm" "k_421nm / k_495nm" "k_421nm / k_582nm"
#> [10] "k_495nm / k_582nm"

obj2 <- decomposition(Scores2, ratios)
colnames(obj2$spc)  # NOT preserved
#>  [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10"