Skip to contents

Gives each site a label such as "Site A", so that tables and figures do not identify a health system. Works for any number of sites (after Site Z the labels continue Site AA, Site AB, ...).

Usage

assign_site_labels(sites, mode = c("random", "ordered"), seed = NULL, prefix = "Site ")

Arguments

sites

Character vector of site keys (duplicates are dropped).

mode

"random" (a random letter per site) or "ordered" (letters follow the order of sites).

seed

Optional integer seed for a repeatable random assignment.

prefix

Text before the letter.

Value

A named character vector: names are the site keys, values the labels.

Details

Keep the mapping private and outside the repository and the shared outputs (save_site_labels()). Assign it once for the whole consortium and give every site the same file, or each site's "Site A" would be a different health system. A seed makes the assignment repeatable in R; R and Python draw different shuffles from the same seed, so share the mapping file, not the seed.

Examples

assign_site_labels(c("north", "south", "east"), mode = "ordered")
#>    north    south     east 
#> "Site A" "Site B" "Site C"