-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from IDEELResearch/feature/mock_stave_prevalence
added example data and script to produce stave object and save to file
- Loading branch information
Showing
6 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# make_example_stave_output.R | ||
# | ||
# Author: Bob Verity | ||
# Date: 2024-09-24 | ||
# | ||
# Inputs: analysis/data/mock_stave.xlsx | ||
# | ||
# Outputs: analysis/data_derived/mock_stave_prevalence.rds | ||
# | ||
# Purpose: | ||
# Creates example STAVE output. Reads in example data, converts to stave, | ||
# calculates prevalence and saves to file. | ||
# | ||
# ------------------------------------------------------------------ | ||
|
||
# install STAVE | ||
#devtools::install_github("mrc-ide/STAVE") | ||
library(STAVE) | ||
|
||
# import mock data | ||
file_path <- "analysis/data/mock_stave.xlsx" | ||
input_studies <- readxl::read_excel(file_path, sheet = "studies") | ||
input_surveys <- readxl::read_excel(file_path, sheet = "surveys") | ||
input_counts <- readxl::read_excel(file_path, sheet = "counts") | ||
|
||
# load into STAVE | ||
s <- STAVE_object$new() | ||
s$append_data(studies_dataframe = input_studies, | ||
surveys_dataframe = input_surveys, | ||
counts_dataframe = input_counts) | ||
|
||
# get prevalence | ||
p <- s$get_prevalence("crt:72:C") | ||
|
||
# save to file | ||
if (FALSE) { | ||
saveRDS(p, file = "analysis/data_derived/mock_stave_prevalence.rds") | ||
} |