From d3b5f4f0caeb6dde9db57a3261150ac37e5d1e74 Mon Sep 17 00:00:00 2001 From: Ryan O'Dea <70209371+ryan-odea@users.noreply.github.com> Date: Wed, 31 Jul 2024 12:22:03 -0400 Subject: [PATCH] added more explicit HTTR retrieval (#9) --- .github/workflows/R-CMD-check.yaml | 59 +++++++++++++++++++ Syndemics/.Rbuildignore | 1 + Syndemics/NAMESPACE | 5 +- Syndemics/R/Syndemics-package.R | 10 ++++ Syndemics/R/fetch_sas.R | 2 +- .../{respond_outputs.R => loadOutputFiles.R} | 0 ..._inputs.R => respond_inputManipulations.R} | 0 Syndemics/man/Syndemics-package.Rd | 11 ++++ Syndemics/man/formula_corr.Rd | 6 +- Syndemics/man/formula_list.Rd | 2 +- Syndemics/man/is.formula.Rd | 2 +- 11 files changed, 89 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/R-CMD-check.yaml create mode 100644 Syndemics/R/Syndemics-package.R rename Syndemics/R/{respond_outputs.R => loadOutputFiles.R} (100%) rename Syndemics/R/{respond_inputs.R => respond_inputManipulations.R} (100%) create mode 100644 Syndemics/man/Syndemics-package.Rd diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..bc2eb2d --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,59 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: R-CMD-check + +permissions: read-all + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: macos-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v4 + with: + working-directory: Syndemics + + - uses: r-lib/actions/setup-pandoc@v2 + with: + working-directory: Syndemics + + - uses: r-lib/actions/setup-r@v2 + with: + working-directory: Syndemics + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + working-directory: Syndemics + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + with: + working-directory: Syndemics + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/Syndemics/.Rbuildignore b/Syndemics/.Rbuildignore index e13c405..31e3754 100644 --- a/Syndemics/.Rbuildignore +++ b/Syndemics/.Rbuildignore @@ -1,3 +1,4 @@ ^.*\.Rproj$ ^\.Rproj\.user$ ^LICENSE\.md$ +^\.github$ diff --git a/Syndemics/NAMESPACE b/Syndemics/NAMESPACE index ae9e28c..880be6f 100644 --- a/Syndemics/NAMESPACE +++ b/Syndemics/NAMESPACE @@ -10,10 +10,13 @@ export(loadOutputFiles) export(new_block) export(replace_vals) import(data.table) -import(httr) importFrom(MASS,glm.nb) importFrom(ggcorrplot,ggcorrplot) importFrom(ggplot2,theme) +importFrom(httr,GET) +importFrom(httr,config) +importFrom(httr,content) +importFrom(httr,stop_for_status) importFrom(stats,as.formula) importFrom(utils,combn) importFrom(utils,read.csv) diff --git a/Syndemics/R/Syndemics-package.R b/Syndemics/R/Syndemics-package.R new file mode 100644 index 0000000..364ffee --- /dev/null +++ b/Syndemics/R/Syndemics-package.R @@ -0,0 +1,10 @@ +#' @keywords internal +"_PACKAGE" + +## usethis namespace: start +#' @importFrom httr config +#' @importFrom httr content +#' @importFrom httr GET +#' @importFrom httr stop_for_status +## usethis namespace: end +NULL diff --git a/Syndemics/R/fetch_sas.R b/Syndemics/R/fetch_sas.R index d3d421d..f7d725f 100644 --- a/Syndemics/R/fetch_sas.R +++ b/Syndemics/R/fetch_sas.R @@ -1,7 +1,7 @@ #' MA DPH PHDW Script Pull #' Fetches most recent .SAS files for MA DPH work and saves them to a SAS/ subdirectory #' -#' @import httr +#' @importFrom httr GET stop_for_status content config #' #' @export fetch_sas <- function(){ diff --git a/Syndemics/R/respond_outputs.R b/Syndemics/R/loadOutputFiles.R similarity index 100% rename from Syndemics/R/respond_outputs.R rename to Syndemics/R/loadOutputFiles.R diff --git a/Syndemics/R/respond_inputs.R b/Syndemics/R/respond_inputManipulations.R similarity index 100% rename from Syndemics/R/respond_inputs.R rename to Syndemics/R/respond_inputManipulations.R diff --git a/Syndemics/man/Syndemics-package.Rd b/Syndemics/man/Syndemics-package.Rd new file mode 100644 index 0000000..cfbf72b --- /dev/null +++ b/Syndemics/man/Syndemics-package.Rd @@ -0,0 +1,11 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/Syndemics-package.R +\docType{package} +\name{Syndemics-package} +\alias{Syndemics} +\alias{Syndemics-package} +\title{Syndemics: A collection of miscellaneous functions created for internal use with the Boston Medical Center Syndemics lab} +\description{ +The Syndemics Lab is a research unit with Boston Medical Center. Our primary work involves dynamic simulations for predicting and analyzing opioid use disorder, HIV, and HEP-CE. This package is a collection of commonly used workflow functionalizations serving analytic purposes. +} +\keyword{internal} diff --git a/Syndemics/man/formula_corr.Rd b/Syndemics/man/formula_corr.Rd index 39964e6..25bd652 100644 --- a/Syndemics/man/formula_corr.Rd +++ b/Syndemics/man/formula_corr.Rd @@ -1,11 +1,9 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/internalTools_crc.R +% Please edit documentation in R/internal_crcTools.R \name{formula_corr} \alias{formula_corr} \title{Internal function to create a formula based on correlation among databases listed in \code{CRC}} \usage{ -formula_corr(corr_matrix, threshold, freq.column) - formula_corr(corr_matrix, threshold, freq.column) } \arguments{ @@ -16,8 +14,6 @@ formula_corr(corr_matrix, threshold, freq.column) \item{freq.column}{frequency column, e.g. N_ID} } \description{ -Internal function to create a formula based on correlation among databases listed in \code{CRC} - Internal function to create a formula based on correlation among databases listed in \code{CRC} } \keyword{internal} diff --git a/Syndemics/man/formula_list.Rd b/Syndemics/man/formula_list.Rd index 54d38f0..73b5c00 100644 --- a/Syndemics/man/formula_list.Rd +++ b/Syndemics/man/formula_list.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/internalTools_crc.R +% Please edit documentation in R/internal_crcTools.R \name{formula_list} \alias{formula_list} \title{Generates All Possible Combination of Interaction Terms diff --git a/Syndemics/man/is.formula.Rd b/Syndemics/man/is.formula.Rd index 300fe87..41092d9 100644 --- a/Syndemics/man/is.formula.Rd +++ b/Syndemics/man/is.formula.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/internalTools_crc.R +% Please edit documentation in R/internal_crcTools.R \name{is.formula} \alias{is.formula} \title{Formula Objects