# \donttest{
# Create temporary directories for example
temp_dir <- tempfile()
dir.create(temp_dir)
# Create sample RDS database
sample_db <- list(
methods = list(
sampling = "Random sampling",
analysis = "Regression analysis"
)
)
rds_path <- file.path(temp_dir, "methods_db.rds")
saveRDS(sample_db, rds_path)
# Convert to JSON
json_path <- file.path(temp_dir, "methods_db.json")
boilerplate_rds_to_json(rds_path, quiet = TRUE)
# Compare original and migrated databases
differences <- compare_rds_json(rds_path, json_path)
if (length(differences) == 0) {
message("Migration successful - databases are equivalent!")
} else {
# Review differences
for (diff in differences) {
cat(sprintf("Difference at %s: %s\n", diff$path, diff$type))
}
}
# Clean up
unlink(temp_dir, recursive = TRUE)
# }
Run the code above in your browser using DataLab