timeline | R Documentation |
Check if a timeseries is continuous. Even if a timeseries does not contain obvious gaps, this does not automatically mean it is also continuous.
timeline(df_current, datetime_variable, expected_lag = 1)
df_current |
data.frame, the newest/current version of dataset x. |
datetime_variable |
string, the "datetime" variable that should be checked for continuity. |
expected_lag |
numeric, the acceptable difference between timestep for
a timeseries to be classed as continuous. Any difference greater than
|
Measuring instruments can have different behaviours when they fail. For example, during power failure an internal clock could reset to "1970-01-01", or the manufacturing date (say, "2021-01-01"). This leads to unpredictable ways of checking if a dataset is continuous.
The timeline_group()
and timeline()
functions attempt to give the user
control over how to check for continuity by providing an expected_lag
. The
difference between timesteps in a dataset should not exceed the
expected_lag
.
Note: for monthly data it is recommended you convert your Date column to a monthly format (e.g 2024-October, 10-2024, Oct-2024 etc.), so a constant expected lag can be set (not a range of 29 - 31 days).
A boolean, TRUE if the timeseries is continuous, and FALSE if there are more than one continuous timeseries within the dataset.
timeline_group()
# A nice continuous dataset should return TRUE
butterfly::timeline(
forestprecipitation$january,
datetime_variable = "time",
expected_lag = 1
)
# In February, our imaginary rain gauge's onboard computer had a failure.
# The timestamp was reset to 1970-01-01
butterfly::timeline(
forestprecipitation$february,
datetime_variable = "time",
expected_lag = 1
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.