# \donttest{
# 1. Locate the example initial samples file included with the package
initial_file <- system.file(
"extdata", "initial_samples_example.csv",
package = "topolow"
)
# 2. Create a temporary directory for the function's output
# This function requires a writable directory for its results.
temp_out_dir <- tempdir()
# 3. Create a sample distance matrix for the function to use
dist_mat <- matrix(runif(100, 1, 10), 10, 10)
diag(dist_mat) <- 0
# 4. Run the adaptive sampling only if the example file is found
if (nzchar(initial_file)) {
run_adaptive_sampling(
initial_samples_file = initial_file,
scenario_name = "adaptive_test_example",
distance_matrix = dist_mat,
output_dir = temp_out_dir,
num_parallel_jobs = 2, # Use small values for a quick example
num_samples = 2,
verbose = FALSE
)
# 5. Verify output files were created
print("Output files from adaptive sampling:")
print(list.files(temp_out_dir, recursive = TRUE))
# 6. Clean up the temporary directory
unlink(temp_out_dir, recursive = TRUE)
}
# }
Run the code above in your browser using DataLab