#!/usr/bin/env Rscript

data = read.table("data/Q_06_latest-2024-2025_RR-T-Vent.csv", sep = ";", header = TRUE)
str(data)

# Keep only columns of interest
data_interest = data[, c("NUM_POSTE", "NOM_USUEL", "AAAAMMJJ", "RR", "TN", "TX", "TM")]

# Keep only data for Nice and for august 2025 
filtered_name = data_interest[which(data$NOM_USUEL == "NICE"),]
nrow(filtered_name)

filtered_date = filtered_name[which(filtered_name$AAAAMMJJ > 20250731),]
nrow(filtered_date)

# Export filtered data
write.table(filtered_date, file = "data/Q_06_latest-2024-2025_RR-T-Vent_filtered_Nice_20250801-26.csv", sep = ";", row.names = FALSE, col.names = TRUE)
