diff --git a/module2/exo4/prep_data.R b/module2/exo4/prep_data.R new file mode 100644 index 0000000000000000000000000000000000000000..695bcbaf3be01f5dc10e22506ba437be12db415d --- /dev/null +++ b/module2/exo4/prep_data.R @@ -0,0 +1,17 @@ +#!/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)