diff --git a/.Rbuildignore b/.Rbuildignore
index 1d85ebc2..c586da17 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -16,3 +16,4 @@
^cran-comments\.md$
^CRAN-RELEASE$
^\.github$
+^codecov\.yml$
diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml
new file mode 100644
index 00000000..27d45283
--- /dev/null
+++ b/.github/workflows/test-coverage.yaml
@@ -0,0 +1,50 @@
+# 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@v3
+
+ - 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,
+ clean = FALSE,
+ install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
+ )
+ shell: Rscript {0}
+
+ - name: Show testthat output
+ if: always()
+ run: |
+ ## --------------------------------------------------------------------
+ find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
+ shell: bash
+
+ - name: Upload test results
+ if: failure()
+ uses: actions/upload-artifact@v3
+ with:
+ name: coverage-test-failures
+ path: ${{ runner.temp }}/package
diff --git a/README.Rmd b/README.Rmd
index d15efed4..692f58a0 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -19,6 +19,7 @@ knitr::opts_chunk$set(
[](https://cran.r-project.org/package=iglu)[](https://CRAN.R-project.org/package=iglu)
[](https://github.com/irinagain/iglu/actions)
[](https://github.com/irinagain/iglu/actions/workflows/R-CMD-check.yaml)
+[](https://app.codecov.io/gh/irinagain/iglu?branch=master)
iglu: Interpreting data from Continuous Glucose Monitors (CGMs)
diff --git a/README.md b/README.md
index 22f8fc7c..02194479 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,9 @@
[](https://cran.r-project.org/package=iglu)[](https://CRAN.R-project.org/package=iglu)
[](https://github.com/irinagain/iglu/actions)
+[](https://github.com/irinagain/iglu/actions/workflows/R-CMD-check.yaml)
+[](https://app.codecov.io/gh/irinagain/iglu?branch=master)
# iglu: Interpreting data from Continuous Glucose Monitors (CGMs)
@@ -20,18 +23,17 @@ the package, see [package website](https://irinagain.github.io/iglu/).
To cite:
-- Broll S, Urbanek J, Buchanan D, Chun E, Muschelli J, Punjabi N and
- Gaynanova I (2021). [Interpreting blood glucose data with R package
- iglu.](https://doi.org/10.1371/journal.pone.0248560) *PLoS One*,
- Vol. 16, No. 4, e0248560.
+- Broll S, Urbanek J, Buchanan D, Chun E, Muschelli J, Punjabi N and
+ Gaynanova I (2021). [Interpreting blood glucose data with R package
+ iglu.](https://doi.org/10.1371/journal.pone.0248560) *PLoS One*, Vol.
+ 16, No. 4, e0248560.
-- Broll S, Buchanan D, Chun E, Muschelli J, Fernandes N, Seo J, Shih
- J, Urbanek J, Schwenck J, Gaynanova I (2021). iglu: Interpreting
- Glucose Data from Continuous Glucose Monitors. R package version
- 3.0.0.
+- Broll S, Buchanan D, Chun E, Muschelli J, Fernandes N, Seo J, Shih J,
+ Urbanek J, Schwenck J, Gaynanova I (2021). iglu: Interpreting Glucose
+ Data from Continuous Glucose Monitors. R package version 3.0.0.
-iglu comes with two example datasets: example_data_1\_subject and
-example_data_5\_subject. These data are collected using Dexcom G4 CGM on
+iglu comes with two example datasets: example_data_1_subject and
+example_data_5_subject. These data are collected using Dexcom G4 CGM on
subjects with Type II diabetes. Each dataset follows the structure
iglu’s functions are designed around. Note that the 1 subject data is a
subset of the 5 subject data. See the examples below for loading and
@@ -54,8 +56,6 @@ devtools::install_github("irinagain/iglu", build_vignettes = TRUE)
``` r
library(iglu)
-#> Warning in register(): Can't find generic `scale_type` in package ggplot2 to
-#> register S3 method.
data(example_data_1_subject) # Load single subject data
## Plot data
@@ -66,6 +66,7 @@ plot_glu(example_data_1_subject)
``` r
+
# Summary statistics and some metrics
summary_glu(example_data_1_subject)
#> # A tibble: 1 × 7
@@ -102,11 +103,13 @@ conga(example_data_1_subject)
data(example_data_5_subject)
plot_glu(example_data_5_subject, plottype = 'lasagna', datatype = 'average')
+#> Warning: Removed 5 rows containing missing values (`geom_tile()`).
```
``` r
+
below_percent(example_data_5_subject, targets = c(80,170,260))
#> # A tibble: 5 × 4
#> id below_170 below_260 below_80
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 00000000..04c55859
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,14 @@
+comment: false
+
+coverage:
+ status:
+ project:
+ default:
+ target: auto
+ threshold: 1%
+ informational: true
+ patch:
+ default:
+ target: auto
+ threshold: 1%
+ informational: true
diff --git a/man/figures/README-unnamed-chunk-3-1.png b/man/figures/README-unnamed-chunk-3-1.png
index c09a89be..60043bf5 100644
Binary files a/man/figures/README-unnamed-chunk-3-1.png and b/man/figures/README-unnamed-chunk-3-1.png differ
diff --git a/man/figures/README-unnamed-chunk-3-2.png b/man/figures/README-unnamed-chunk-3-2.png
index edfb9687..87148a6a 100644
Binary files a/man/figures/README-unnamed-chunk-3-2.png and b/man/figures/README-unnamed-chunk-3-2.png differ