Skip to content

Commit

Permalink
Merge pull request #13 from IDEELResearch/feature/mock_stave_prevalence
Browse files Browse the repository at this point in the history
added example data and script to produce stave object and save to file
  • Loading branch information
shaziaruybal authored Sep 24, 2024
2 parents 3fd3e3e + a1dbf76 commit a1f5afa
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added analysis/.DS_Store
Binary file not shown.
Binary file added analysis/data/mock_stave.xlsx
Binary file not shown.
Binary file added analysis/data/~$mock_stave.xlsx
Binary file not shown.
Binary file added analysis/data_derived/mock_stave_prevalence.rds
Binary file not shown.
38 changes: 38 additions & 0 deletions analysis/make_example_stave_output.R
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")
}

0 comments on commit a1f5afa

Please sign in to comment.