Skip to content

Commit

Permalink
Merge pull request #5 from jackwasey/test-update
Browse files Browse the repository at this point in the history
Update testing from travis and appveyor to GitHub actions
  • Loading branch information
jackwasey authored Mar 15, 2024
2 parents f7c46ae + 236433c commit 04f10ab
Show file tree
Hide file tree
Showing 25 changed files with 269 additions and 332 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ man-roxygen
.*\.ods$
physiology\.Rcheck
physiology_.*\.tar\.gz
^\.github$
^\.lintr$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
49 changes: 49 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 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

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@v2

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
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:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
30 changes: 30 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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: lint

jobs:
lint:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::lintr, local::.
needs: lint

- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
31 changes: 31 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
needs: coverage

- name: Test coverage
run: covr::codecov(quiet = FALSE)
shell: Rscript {0}
3 changes: 2 additions & 1 deletion .lintr
95 changes: 0 additions & 95 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ Suggests:
knitr,
spelling,
tidyr,
utils
utils,
covr
LinkingTo:
Rcpp
VignetteBuilder:
Expand Down
18 changes: 12 additions & 6 deletions R/bmi.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ ideal_weight <- function(height_m, ..., age_y = NULL, male = NULL) {

#' @describeIn ideal_weight Ideal weight of an adult
#' @export
ideal_weight_adult <- function(height_m, male, ...)
ideal_weight_adult <- function(height_m, male, ...) {
ideal_weight_Devine(height_m, male, ...)
}

#' @describeIn ideal_weight Ideal weight of a child, age >= 1 and age < 18 years
#' @export
ideal_weight_child <- function(height_m, age_y = NULL, ...)
ideal_weight_child <- function(height_m, age_y = NULL, ...) {
ideal_weight_Traub(height_m, age_y, ...)
}

#' ideal weight for child per Traub
#'
Expand Down Expand Up @@ -76,8 +78,9 @@ ideal_weight_Traub <- function(height_m, age_y = NULL, ...) {
#' ref.)
#' @rdname ideal_weight
#' @export
ideal_weight_Devine <- function(height_m, male, ...)
ideal_weight_Devine <- function(height_m, male, ...) {
ideal_weight_linear(height_m, male, 60, 50, 45.5, 2.3, 2.3, ...)
}

#' @title ideal weight by Robinson method
#' @rdname ideal_weight
Expand All @@ -86,8 +89,9 @@ ideal_weight_Devine <- function(height_m, male, ...)
#' relationship. (Robinson JD, Lupkiewicz SM, Palenik L et al. Determination
#' of ideal body weight for drug dosage calculations. Am J Hosp Pharm 1983;
#' 40: 1016-9.)
ideal_weight_Robinson <- function(height_m, male, ...)
ideal_weight_Robinson <- function(height_m, male, ...) {
ideal_weight_linear(height_m, male, 60, 52, 49, 1.9, 1.7, ...)
}


#' @title ideal weight by Miller
Expand All @@ -96,17 +100,19 @@ ideal_weight_Robinson <- function(height_m, male, ...)
#' @description Miller's method for ideal weight: different linear relationship.
#' (Miller DR, Carlson JD, Loyd BJ et al. Determining ideal body weight.
#' (Letter). Am J Hosp Pharm 1983; 40: 1622.)
ideal_weight_Miller <- function(height_m, male, ...)
ideal_weight_Miller <- function(height_m, male, ...) {
ideal_weight_linear(height_m, male, 60, 56.2, 53.1, 1.41, 1.36, ...)
}

#' @title ideal weight by Broca
#' @description Calculate ideal weight based on Broca (1871) Height in cm -100
#' for women, -105 for men Broca PP. Memoires d'anthropologie. Paris 1871 /
#' 1877.
#' @rdname ideal_weight
#' @export
ideal_weight_Broca <- function(height_m, male, ...)
ideal_weight_Broca <- function(height_m, male, ...) {
ideal_weight_linear(height_m, male, 0, -100, -105, 2.54, 2.54, ...)
}

#' @title ideal weight by Lemmens
#' @description Lemmens method assumes BMI 22 as ideal (Obesity Surgery 2005)
Expand Down
3 changes: 2 additions & 1 deletion R/deadspace.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ deadspace_anatomic_child <- function(ideal_weight_kg, age_y = NULL) {
#' independent
#' @details 'Mean intrathoracic anatomic dead space was 1.03 ml/kg and was not
#' related to age.' Numa, 1985
deadspace_intrathoracic_ml <- function(ideal_weight_kg)
deadspace_intrathoracic_ml <- function(ideal_weight_kg) {
1.03 * ideal_weight_kg
}

# nocov start
deadspace_extrathoracic <- function(ideal_weight_kg = NULL, age_y = NULL) {
Expand Down
4 changes: 2 additions & 2 deletions R/eGFR.R
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ egfr_mdrd <- function(scr_uM, age_y, male, black, idms_assay = TRUE,
(age_y ^ (-0.203)) *
(0.742 + 0.258 * male) *
(1 + 0.212 * black)
if (any(ret > 60) & warn_ckdepi_preferred)
if (any(ret > 60) && warn_ckdepi_preferred)
warning("The MDRD equation for eGFR is not recommended for values above ",
"60 mL/min/1.73m^2 (CKD-EPI is recommended). ",
"Use results above 60 with caution.")
Expand Down Expand Up @@ -245,7 +245,7 @@ egfr_ckdepi <- function(scr_uM, age_y, male, black, idms_assay = TRUE,
0.993 ^ age_y *
(1.018 - 0.018 * male) *
(1 + 0.159 * black)
if (any(ret < 60) & warn_mdrd_preferred) {
if (any(ret < 60) && warn_mdrd_preferred) {
warning("The CKD-EPI equation for eGFR is not recommended for values below",
" 60 mL/min/1.73m^2 (MDRD is recommended). Use with caution.")
}
Expand Down
10 changes: 6 additions & 4 deletions R/physics.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
#' @param temp_c Temperature in Celsius
#' @family physics
#' @export
temp_c_to_k <- function(temp_c)
temp_c_to_k <- function(temp_c) {
273.15 + temp_c
}

#' Saturation vapor pressure of water at sea level
#' @param temp_k Temperature in Kelvin
#' @family physics
#' @export
svp_sea_level <- function(temp_k)
svp_sea_level <- function(temp_k) {
0.00750061683 *
exp(77.345 + 0.0057 * temp_k - 7235 / temp_k) /
temp_k ^ 8.2
exp(77.345 + 0.0057 * temp_k - 7235 / temp_k) /
temp_k ^ 8.2
}

#' Conversion factor from Pa to torr (mmHg)
#'
Expand Down
5 changes: 3 additions & 2 deletions R/valid.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ valid_age <- function(age_y, age_min = 0, age_max = 150,
valid_age_adult <- function(age_y, age_min = 18, age_max = 150,
age_min_hard = 17, age_max_hard = 150,
extra_msg = "", do_warn = TRUE, do_stop = FALSE,
equal_ok = FALSE)
equal_ok = FALSE) {
valid(age_y, "age", "yr",
age_min, age_max, age_min_hard, age_max_hard,
extra_msg, do_warn, do_stop, equal_ok = equal_ok)
}

#' @rdname valid_height
#' @param scr_uM numeric serum creatinine (umol/L)
Expand All @@ -103,7 +104,7 @@ valid_age_adult <- function(age_y, age_min = 18, age_max = 150,
#' \code{warn}
#' @export
valid_creatinine <- function(scr_uM, scr_min = 8, scr_max = 1000,
scr_min_hard=0, scr_max_hard = 4000,
scr_min_hard = 0, scr_max_hard = 4000,
extra_msg = "", do_warn = TRUE, do_stop = FALSE,
equal_ok = FALSE) {
# Note that scr_min was selected to help ensure that unit conversion errors
Expand Down
7 changes: 4 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ knitr::opts_chunk$set(

# physiology

<!-- badges: start -->
[![R-CMD-check](https://github.com/jackwasey/physiology/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jackwasey/physiology/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/physiology)](https://cran.r-project.org/package=physiology)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![Travis build Status](https://travis-ci.org/jackwasey/physiology.svg?branch=master)](https://travis-ci.org/jackwasey/physiology)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/jackwasey/physiology?branch=master&svg=true)](https://ci.appveyor.com/project/jackwasey/physiology)
[![Coverage status](https://codecov.io/gh/jackwasey/physiology/branch/master/graph/badge.svg)](https://codecov.io/github/jackwasey/physiology?branch=master)
[![Codecov test coverage](https://codecov.io/gh/jackwasey/physiology/branch/master/graph/badge.svg)](https://app.codecov.io/gh/jackwasey/physiology?branch=master)
[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
<!-- badges: end -->

## Calculate physiologic characteristics of awake and anesthetized adults, children and infants

Expand Down
Loading

0 comments on commit 04f10ab

Please sign in to comment.