Skip to contents

Writes or updates the sensor data in the data folder. It retrieves the data for the specified sensor between start_date and end_date (inclusive) using the retrieve_sensor function, and then converts certain columns to character strings before writing the data to a RData file in the data folder (if create_directory = TRUE), to a temporary folder otherwise.

Usage

write_update_data(segment_name, start_date, end_date, create_directory = FALSE)

Arguments

segment_name

Character. Name of the segment, as specified in config.

start_date

Date. Start date "aaaa-mm-jj"

end_date

Date. End date "aaaa-mm-jj"

create_directory

Boolean: Does the file need to be created in the project directory? Default to FALSE.

Value

Boolean: TRUE if the data is well saved/written, FALSE otherwise (no data for example)

Examples

if (FALSE)  # This function requires a valid API key
period <- as.Date(c('2022-01-01', '2022-12-31'))
write_update_data('RteVitre-06', period[1], period[2])
#> Error in eval(expr, envir, enclos): object 'period' not found