add_timezones_to_db: Add timezone to measurements in an m-Path Sense database
Description
This function looks for a Timezone table in a local m-Path Sense SQLite database and uses it
to assign timezone values to all other sensor tables. For each observation in a sensor table,
it finds the timezone interval that matches the observation's timestamp and adds or updates a
timezone column accordingly.
Invisibly returns TRUE if all updates complete successfully.
Arguments
db
A database connection, typically created by open_db().
sensors
A character vector of sensor table names to update. Defaults to NULL for all supported
sensors.
.progress
Logical; whether to show a progress bar during processing. Defaults to TRUE.
Details
Note that rerunning this function overwrites existing timezone columns in the sensor tables.
Also note that if a measurement matches multiple time zones (i.e. a timezone change occurred
during the measurement), the timezone with the longest overlap is chosen.
if (FALSE) {
# Connect to an m-Path Sense databasedb <- open_db("path/to/db.sqlite")
# Add timezone information to all tablesadd_timezones_to_db(db)
# Disconnect when doneclose_db(db)
}