An R package (just called reskit) that helps process NHP model results.
You should be able to run the following R command to install {reskit}:
# install.packages("pak") # if not already installed
pak::pak("The-Strategy-Unit/nhp_reskit")
On Windows, you may need to have RTools already installed in order to install reskit.
As this package relies on {azkit} for some of its functionality, you
will need certain environment variables to be available (see section below) in
order for these to work.
It is a good idea to check that your azkit authentication is set up correctly before using this package. Try:
az login
at your terminal, or
azkit::get_auth_token()
to check these are running correctly.
Some key functions and workflows you might want to use include:
# This assumes you have Azure authentication working, and the correct
# Azure endpoint variables in your environment.
# NB the file/data locations used here are invented examples.
# The best way to obtain a real results folder location is probably to read and
# filter a table of model runs metadata and extract the appropriate path
# variable; see `azkit::read_azure_table` for help with this.
data_container <- azkit::get_container("data_container")
results_location <- "results/dev/national/test"
results <- reskit::read_results_parquet_files(data_container, results_location)
This should return a named list of tibbles, stored as results, one for each
parquet file in the results location folder.
# NB do not add the `.parquet` ext; just the basename of the file is required
selected_tables <- c("acuity", "default")
selected_results <- data_container |>
reskit::read_results_parquet_files(results_location, selected_tables)
# generates a {gt} (HTML) table
reskit::compile_principal_pod_data(results) |>
reskit::make_principal_pod_table()
See the "Plots and tables with reskit" vignette for more examples of things you can do.
To access Azure Storage you need to add some variables to a
.Renviron file in your project.
⚠️These values are sensitive and should not be exposed to anyone outside The
Strategy Unit.
Make sure you include .Renviron in the .gitignore file for
your project.
Your .Renviron file should contain the variables below.
Ask a member of the Data Science team for the necessary values.
AZ_STORAGE_EP=[your azure storage blob endpoint url]
For convenience, an example .Renviron.example file is provided in this
repository.
You can copy/save it, renamed to just .Renviron, to the root of any project
folder where you are using {reskit}.
Please use the Issues feature on GitHub to report any bugs, ideas or problems, including with the package documentation.
Alternatively, to ask any questions about the package you may contact Fran Barton.