iAM-AMR / sawmill

An R package used to prepare queries from CEDAR (timber) for use in the iAM.AMR models
GNU General Public License v3.0
1 stars 1 forks source link
cedar

TLP White Level Badge Version Badge

 ______     ______     __     __     __    __     __     __         __        
/\  ___\   /\  __ \   /\ \  _ \ \   /\ "-./  \   /\ \   /\ \       /\ \       
\ \___  \  \ \  __ \  \ \ \/ ".\ \  \ \ \-./\ \  \ \ \  \ \ \____  \ \ \____  
 \/\_____\  \ \_\ \_\  \ \__/".~\_\  \ \_\ \ \_\  \ \_\  \ \_____\  \ \_____\ 
  \/_____/   \/_/\/_/   \/_/   \/_/   \/_/  \/_/   \/_/   \/_____/   \/_____/ 

sawmill: an R package to use CEDAR data for an iAM.AMR model

The iAM.AMR models are informed by one or more queries (timber) from the CEDAR (Collection of Epidemiologically Derived Associations with Resistance) database. The sawmill package processes timber by performing basic quality control, calculating model parameters (e.g., odds ratios), and performing meta-analyses.

Installation and Use

Install sawmill

To install sawmill using the bootstrap method (recommended), follow the instructions to download and execute the bootstrap.R script.

Use sawmill

Use sawmill with a cached copy of timber

A cached copy of a timber object with all resistance-outcomes in CEDAR is included as local_timber. To use this cached copy, first filter as necessary, then write to a .CSV. Open this file in Excel or another editor to make any required changes (e.g., add meta-analysis groupings), and save as a .XLSX. Then, use sawmill as instructed above. An exmaple of the R code:

library(tidyverse)

local_timber %>% 
  dplyr::filter(is_archived == FALSE,                     # Filter out archived references
                is_excluded_extract == FALSE,             # Filter out excluded references
                capture_search_2019 == TRUE) %>%          # Select only the iAM.AMR.SEARCH project references
  dplyr::select(-is_archived, -is_excluded_extract, -capture_search_2019, -cedar_extract_esr) %>%
  readr::write_csv(file.choose())

Update sawmill

To update to the latest release, run sawmill::update_sawmill().

Get Help

FAQ

What is CEDAR? iAM.AMR?

Why is an R package, and why do I need this one?

According to Hadley Wickham and Jennifer Bryan:

In R, the fundamental unit of shareable code is the package. A package bundles together code, data, documentation, and tests, and is easy to share with others.

When we export queries from CEDAR (which we call timber), they lack important information for modelling. The sawmill package is a collection of functions that prepare the queries for use in the iAM.AMR models.

I normally install packages from CRAN using install.packages(); why doesn't this work for sawmill?

sawmill is not currently available in CRAN.

Where can I find more information about the package or individual functions?

Try accessing the individual function help files -- using R's ?function() notation -- or consulting the iAM.AMR project's documentation.

sawmill is set up so that its main functions (a.k.a. main steps in the processing pipeline) exist within their own .R files, found in the R directory of this repository. For example, the function sawmill::debark() is found in debark.R. To access the help file for this function, enter ?debark() or ?sawmill::debark() into the RStudio console.

Contact

Created by @chapb and @phillipsclynn. Maintained by \@chapb.

Install sawmill for Developers

To build sawmill locally:

  1. Use the Code Badge button above to clone or download the repo.
  2. Launch the sawmill.Rproj in RStudio
  3. Use Install and Restart in the Buid tab to build and attach the package locally.