mc_states_update | R Documentation |
This function updates (replaces) existing states (tags). For more information about the structure of states (tags), see myClim-package. In contrast with mc_states_insert, which does not affect existing states (tags), mc_states_update deletes all old states and replaces them with new ones, even if the new states table contains fewer states than original object.
mc_states_update(data, states_table)
data |
cleaned myClim object see myClim-package |
states_table |
Output of data.frame with columns:
|
As a template for updating states (tags), it is recommended to use
the output of mc_info_states()
, which will return the table with all necessary
columns correctly named. The sensor_name
and value
columns are optional and do not
need to be filled in.
The states (tags) are associated with the sensor time-series, specifically to
the defined part of the time-series identified by start and end date times. A
single time series can contain multiple states (tags) of identical or different types, and these
states (tags) can overlap. Start and end date times are adjusted to fit within
the range of logger/locality datetime and are rounded according to the logger's step. For instance,
if a user attempts to insert a tag beyond the sensor time-series range, mc_states_insert
will adjust the start and end times to fit the available measurements. If a user defines a start time as
'2020-01-01 10:23:00' on a logger with a 15-minute step, it will be rounded to '2020-01-01 10:30:00'.
In contrast with mc_states_insert, the automatic filling of states when locality_id
is provided but sensor_name
is NA is not implemented in mc_states_update. When a user needs to update
states (tags) for all sensors within the locality, each state (tag) needs to have a separate row in
the input table.
myClim object in the same format as input, with updated sensor states
states <- mc_info_states(mc_data_example_clean)
states$value <- basename(states$value)
data <- mc_states_update(mc_data_example_clean, states)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.