mutate.hyperSpec.Rd
mutate
adds new variables and preserves all the existing variables.
Special column $spc
contains the spectra matrix.
# S3 method for hyperSpec
mutate(.data, ...)
A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr). See Methods, below, for more details.
<data-masking
> Name-value pairs.
The name gives the name of the column in the output.
The value can be:
A vector of length 1, which will be recycled to the correct length.
A vector the same length as the current group (or the whole data frame if ungrouped).
NULL
, to remove the column.
A data frame or tibble, to create multiple columns in the output.
hyperSpec object.
laser %>%
mutate(t, filename)
#> hyperSpec object
#> 84 spectra
#> 3 data columns
#> 36 data points / spectrum
head # => results in a hyperSpec object
#> function (x, ...)
#> UseMethod("head")
#> <bytecode: 0x7f9016ae6550>
#> <environment: namespace:utils>
laser %>%
mutate(-spc) # => results in a hyperSpec object
#> hyperSpec object
#> 84 spectra
#> 4 data columns
#> 36 data points / spectrum
laser %>%
mutate(spc2 = spc * 2) %>%
mutate(spc2) %>%
mutate(spc2 * 2) # => results in a hyperSpec object
#> hyperSpec object
#> 84 spectra
#> 5 data columns
#> 36 data points / spectrum