30 lines
951 B
R
30 lines
951 B
R
# Merge all CI RDS files into a single CSV
|
|
library(tidyverse)
|
|
|
|
# Paths
|
|
ci_data_dir <- "r_app/experiments/ci_graph_exploration/CI_data"
|
|
output_csv <- "python_app/lstm_ci_data_combined.csv"
|
|
|
|
# Find all RDS files
|
|
rds_files <- list.files(ci_data_dir, pattern = "\\.rds$", full.names = TRUE)
|
|
print(paste("Found", length(rds_files), "RDS files"))
|
|
|
|
# Load and combine all files
|
|
combined_data <- tibble()
|
|
|
|
for (file in rds_files) {
|
|
filename <- basename(file)
|
|
client_name <- sub("\\.rds$", "", filename) # Extract client name from filename
|
|
print(paste("Loading:", filename, "- Client:", client_name))
|
|
data <- readRDS(file)
|
|
data$client <- client_name
|
|
combined_data <- bind_rows(combined_data, data)
|
|
}
|
|
|
|
print(paste("Total rows:", nrow(combined_data)))
|
|
print(paste("Columns:", paste(names(combined_data), collapse = ", ")))
|
|
|
|
# Write to CSV
|
|
write.csv(combined_data, output_csv, row.names = FALSE)
|
|
print(paste("✓ Saved to:", output_csv))
|