mc_states_replace {myClim} | R Documentation |
Replace values by states with tag
Description
This function replace values of sensors by states with tag.
Usage
mc_states_replace(data, tags, replace_value = NA, crop_margins_NA = FALSE)
Arguments
data |
myClim object see myClim-package |
tags |
tag assigned to the the sensor values to be replaced. e.g. "error" |
replace_value |
(default NA) The value which will be written into sensor. |
crop_margins_NA |
if TRUE function crops NAs on the beginning or end of time-series (default FALSE) |
Details
The typical use of this function is for deleting/removing error/compromised
records from time-series by tagging them and then replacing tagged values with NA.
Typically, when error/unwanted data appears at the beginning or end of time series, it
can be useful to crop time-series (delete records completely) using crop_margins_NA
.
Value
myClim object in the same format as input, with replaced values
Examples
states <- data.frame(locality_id="A1E05", logger_name="Thermo_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)
data <- mc_states_replace(data, "error")
[Package myClim version 1.4.0 Index]