-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.R
40 lines (32 loc) · 1.45 KB
/
example.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Replace the full path by your own path
##detach(package:readr, unload=TRUE)
library(rio)
# set relative paths to input and output dirs
input_dir <- './data/'
output_dir <- './inst/extdata/'
# input files
old_dataset <- import(paste(input_dir, 'restore_old.RData', sep = ''))
new_dataset <- import(paste(input_dir, 'restore_new.RData', sep = ''))
# NOTE: the column names of the following two files cannot be changed.
hierarchy_ordering <- import(paste(input_dir, 'restore_geo_hierarchies.RData', sep = ''))
hierarchy_pairs <- import(paste(input_dir, 'restore_geo_pairs.RData', sep = ''))
# thresholds
metric_thresholds <- import(paste(input_dir, 'restore_thresholds.RData', sep = ''))
# output file
final_report <- paste(output_dir, 'analysis_results_hierarchy.xlsx', sep = '')
# save the output in RData format
# NOTE: you can choose one or both of final_report and final_data
final_data <- paste(output_dir, 'analysis_results_hierarchy.RData', sep = '')
# set column names of key and hierarchy columns in legacy_df and target_df
key <- 'CODE'
hierarchy <-'GEO'
# run the tests
test_two_datasets(legacy_df = old_dataset,
target_df = new_dataset,
hier_df = hierarchy_ordering,
hier_pair_df = hierarchy_pairs,
thresholds_df = metric_thresholds,
final_report = final_report,
final_data = final_data,
key_col = key,
hier_col = hierarchy)