The inverse of write_transport. Optional parts that a site did
not produce come back as NULL rather than erroring.
Value
A list of six elements:
sample_id: the identifier the bundle was written under, whether it was supplied or inferred from the filenames.summary,named: the two tables described intransport_plateau.caps_agreement,sample_info,flow: the optional parts, orNULLwhere the site did not produce them.
Examples
# \donttest{
ptsd_data <- rename_ptsd_columns(
simulated_ptsd_genpop[1:400, c("patient_id", paste0("S", 1:20))],
id_col = "patient_id")
fit <- score_all_combinations(ptsd_data, n_symptoms = 3, n_required = 2,
show_progress = FALSE)
plateau <- compute_plateau(fit, delta = 1)
bundle <- transport_plateau(
ptsd_data,
plateau_specs = list(list(derivation = "example", rule_form = "flat_2_3",
delta = 1, n_required = 2, clusters = NULL,
sets = plateau$sets$combination_id)),
named_specs = list(list(derivation = "example", rule_form = "flat_2_3",
n_required = 2, clusters = NULL,
sets = fit$combination_id[1:3], ranks = 1:3)),
sample_id = "site_a"
)
out <- file.path(tempdir(), "transport_roundtrip")
dir.create(out, showWarnings = FALSE)
write_transport(bundle, out)
#> ✔ Wrote 2 files for "site_a" to /tmp/Rtmp2dnlav/transport_roundtrip.
#> ℹ Return all of them, and nothing else.
returned <- read_transport(out)
returned$sample_id
#> [1] "site_a"
returned$summary
#> sample_id payload_id derivation rule_form delta metric n_sets min
#> 1 site_a NA example flat_2_3 1 ba 1 0.9204812
#> 2 site_a NA example flat_2_3 1 sensitivity 1 0.9213483
#> 3 site_a NA example flat_2_3 1 specificity 1 0.9196141
#> q1 median q3 max
#> 1 0.9204812 0.9204812 0.9204812 0.9204812
#> 2 0.9213483 0.9213483 0.9213483 0.9213483
#> 3 0.9196141 0.9196141 0.9196141 0.9196141
unlink(out, recursive = TRUE)
# }
