mc_states_insert | R Documentation |
This function inserts new states (tags) into the selected part of the sensor
time-series. For more information about the structure of states (tags),
see myClim-package. mc_states_insert()
does not affect
existing rows in the states (tags) table but only inserts new rows even if
the new ones are identical with existing (resulting in duplicated states).
mc_states_insert(data, states_table)
data |
cleaned myClim object see myClim-package |
states_table |
Output of
|
As a template for inserting 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.
When locality_id
is provided but sensor_name
is NA in the states (tags) table,
states are inserted for all sensors within the locality.
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'.
myClim object in the same format as input, with inserted sensor states
states <- data.frame(locality_id="A1E05", logger_index=1, sensor_name="Thermo_T", tag="error",
start=lubridate::ymd_hm("2020-10-28 9:00"),
end=lubridate::ymd_hm("2020-10-28 9:30"))
data <- mc_states_insert(mc_data_example_clean, states)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.