Last chance! 50% off unlimited learning
Sale ends in
Function to set, rename or unset by reference the "idfactor" attribute of an
existing object of class generic_spct
or an object of a class derived
from generic_spct
.
setIdFactor(x, idfactor)id_factor(x) <- value
x
a generic_spct object.
character The name of a factor identifying multiple spectra stored longitudinally.
If the attribute idfactor
is already set, and a variable with
name equal to the value passed as argument to idfactor
does not
exist in x
, the currently set variable is renamed and the attribute
value updated. If a variable named as the argument passed to
idfactor
exists in x
, it will be set as id by storing this
name in the attribute. If the value passed as argument to idfactor
is NULL
the attribute will be unset. If the attribute is not already
set and there is no member variable in x
with a name matching the
argument passed to idfactor
, an error is triggered.
Other idfactor attribute functions:
getIdFactor()
my.spct <- sun_evening.spct
# inspecting
id_factor(sun.spct) # no idfactor set
id_factor(my.spct)
colnames(my.spct)
# renaming
id_factor(my.spct) <- "time"
getIdFactor(my.spct)
colnames(my.spct)
# removing
setIdFactor(my.spct, NULL)
getIdFactor(my.spct)
colnames(my.spct)
Run the code above in your browser using DataLab