diff --git a/.github/workflows/netlify.yaml b/.github/workflows/netlify.yaml new file mode 100644 index 0000000..6dcac9d --- /dev/null +++ b/.github/workflows/netlify.yaml @@ -0,0 +1,53 @@ +on: + pull_request: + branches: [main, master] + +name: pkgdown-pr + +jobs: + netlify: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-tinytex@v2 + + - uses: r-lib/actions/setup-pandoc@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::pkgdown, local::. + needs: website + + - name: Install package + run: R CMD INSTALL . + + - name: Create website + run: | + pkgdown::build_site() + shell: Rscript {0} + + - name: Create index file + run: | + echo ' ' > ./docs/index.html + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v3.0 + with: + publish-dir: './docs' + production-branch: main + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: + 'Deploy from GHA: ${{ github.event.pull_request.title || github.event.head_commit.message }} (${{ github.sha }})' + # these default to 'true' + enable-commit-comment: false + enable-github-deployment: false + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} \ No newline at end of file diff --git a/README.Rmd b/README.Rmd index 8629443..5e74311 100644 --- a/README.Rmd +++ b/README.Rmd @@ -25,11 +25,26 @@ knitr::opts_chunk$set( Ensuring the precision and accuracy of measurements is critical when collecting anthropometric data. Anthropometrists are usually tested for precision and accuracy of measurement through standardisation tests performed prior to anthropometric data collection. This package provides functions to calculate inter- and intra-observer technical error of measurement (TEM) to assess precision of measurements. -## What does `anthrocheckr` do? +## What does the package do? + +`{anthrocheckr}` provides functions for: + +1. Calculating standard summaries for intra-observer or inter-observer measurements; + +2. Calculating intra-observer or inter-observer technical error of measurement (TEM) for multiple subjects and for multiple measurers/observers; + +3. Calculating multiple measurers/observers relative technical error of measurement (relative TEM); + +4. Calculating intra-observer total technical error of measurement (total TEM); + +5. Calculating coefficient of reliability; and, + +6. Calculating bias in measurements/observation against a gold standard. + ## Installation -`anthrocheckr` is not yet on [CRAN](https://cran.r-project.org) but can be installed from the [nutriverse R universe](https://nutriverse.r-universe.dev) as follows: +`{anthrocheckr}` is not yet on [CRAN](https://cran.r-project.org) but can be installed from the [nutriverse R Universe](https://nutriverse.r-universe.dev) as follows: ```{r install-r-universe, eval = FALSE} install.packages( @@ -38,13 +53,15 @@ install.packages( ) ``` + ## Usage + ## Citation -If you find the `anthrocheckr` package useful please cite using the suggested citation provided by a call to the `citation()` function as follows: +If you find the `{anthrocheckr}` package useful please cite using the suggested citation provided by a call to the `citation()` function as follows: ```{r citation} citation("anthrocheckr") diff --git a/README.md b/README.md index 45d5fbd..af46aeb 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,33 @@ performed prior to anthropometric data collection. This package provides functions to calculate inter- and intra-observer technical error of measurement (TEM) to assess precision of measurements. -## What does `anthrocheckr` do? +## What does the package do? + +`{anthrocheckr}` provides functions for: + +1. Calculating standard summaries for intra-observer or inter-observer + measurements; + +2. Calculating intra-observer or inter-observer technical error of + measurement (TEM) for multiple subjects and for multiple + measurers/observers; + +3. Calculating multiple measurers/observers relative technical error of + measurement (relative TEM); + +4. Calculating intra-observer total technical error of measurement + (total TEM); + +5. Calculating coefficient of reliability; and, + +6. Calculating bias in measurements/observation against a gold + standard. ## Installation -`anthrocheckr` is not yet on [CRAN](https://cran.r-project.org) but can -be installed from the [nutriverse R -universe](https://nutriverse.r-universe.dev) as follows: +`{anthrocheckr}` is not yet on [CRAN](https://cran.r-project.org) but +can be installed from the [nutriverse R +Universe](https://nutriverse.r-universe.dev) as follows: ``` r install.packages( @@ -44,7 +64,7 @@ install.packages( ## Citation -If you find the `anthrocheckr` package useful please cite using the +If you find the `{anthrocheckr}` package useful please cite using the suggested citation provided by a call to the `citation()` function as follows: @@ -53,8 +73,9 @@ citation("anthrocheckr") #> To cite anthrocheckr in publications use: #> #> Ernest Guevarra (2024). _anthrocheckr: An Implementation of -#> Anthropometric Measurement Standardisation Tests_. R package -#> version 0.0.9000, . +#> Anthropometric Measurement Standardisation Tests_. R +#> package version 0.0.9000, +#> . #> #> A BibTeX entry for LaTeX users is #> diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index 22d3652..994022d 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -7,16 +7,19 @@ development: template: bootstrap: 5 - bootswatch: cosmo - theme: haddock - ganalytics: # + theme: breeze-light + ganalytics: "G-83YFE32VFQ" + bslib: + bootswatch: pulse + pkgdown-nav-height: 100px + success: "#004225" navbar: bg: success - type: light + type: dark structure: left: [home, intro, reference, articles, news] - right: [mastodon, linkedin, github] + right: [search, mastodon, github] components: articles: @@ -26,10 +29,8 @@ navbar: href: articles/tem.html mastodon: icon: "fab fa-mastodon fa-lg" - href: https://fosstodon.org/@katilingban - linkedin: - icon: "fab fa-linkedin fa-lg" - href: https://www.linkedin.com/company/katilingban + aria-label: Mastodon + href: https://fosstodon.org/@nutriverse home: links: diff --git a/tests/testthat/test-01_summary_measure.R b/tests/testthat/test-01_summary_measure.R new file mode 100644 index 0000000..e834135 --- /dev/null +++ b/tests/testthat/test-01_summary_measure.R @@ -0,0 +1,31 @@ +# Tests for summary measures function ------------------------------------------ + +test_that("calculate_* works as expected", { + expect_type( + calculate_mean( + c( + smartStd[smartStd$observer == 0 , "weight1"], + smartStd[smartStd$observer == 0 , "weight2"] + ) + ), + "double" + ) + expect_type( + calculate_sd( + c( + smartStd[smartStd$observer == 0 , "weight1"], + smartStd[smartStd$observer == 0 , "weight2"] + ) + ), + "double" + ) + expect_type( + calculate_max( + c( + smartStd[smartStd$observer == 0 , "weight1"], + smartStd[smartStd$observer == 0 , "weight2"] + ) + ), + "double" + ) +}) \ No newline at end of file diff --git a/tests/testthat/test-04_calculate_team_tem.R b/tests/testthat/test-04_calculate_team_tem.R new file mode 100644 index 0000000..30e5a6a --- /dev/null +++ b/tests/testthat/test-04_calculate_team_tem.R @@ -0,0 +1,3 @@ +# Tests for calculate_team_tem ------------------------------------------------- + + diff --git a/vignettes/.gitignore b/vignettes/.gitignore new file mode 100644 index 0000000..097b241 --- /dev/null +++ b/vignettes/.gitignore @@ -0,0 +1,2 @@ +*.html +*.R diff --git a/vignettes/anthrocheckr.Rmd b/vignettes/anthrocheckr.Rmd new file mode 100644 index 0000000..62e6bac --- /dev/null +++ b/vignettes/anthrocheckr.Rmd @@ -0,0 +1,51 @@ +--- +title: "Anthropometric measurement standardisation tests" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Anthropometric measurement standardisation tests} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +```{r setup, echo = FALSE} +library(anthrocheckr) +``` + +Ensuring the precision and accuracy of measurements is critical when collecting anthropometric data. Anthropometrists are usually tested for precision and accuracy of measurement through standardisation tests performed prior to anthropometric data collection. This package provides functions to calculate inter- and intra-observer technical error of measurement (TEM) to assess precision of measurements. + +## What does anthrocheckr do? + +`{anthrocheckr}` provides functions for: + +1. Calculating standard summaries for intra-observer or inter-observer measurements; + +2. Calculating intra-observer or inter-observer technical error of measurement (TEM) for multiple subjects and for multiple measurers/observers; + +3. Calculating multiple measurers/observers relative technical error of measurement (relative TEM); + +4. Calculating intra-observer total technical error of measurement (total TEM); + +5. Calculating coefficient of reliability; and, + +6. Calculating bias in measurements/observation against a gold standard. + + +## Installation + +`{anthrocheckr}` is not yet on [CRAN](https://cran.r-project.org) but can be installed from the [nutriverse R Universe](https://nutriverse.r-universe.dev) as follows: + +```{r install-r-universe, eval = FALSE} +install.packages( + "anthrocheckr", + repos = c('https://nutriverse.r-universe.dev', 'https://cloud.r-project.org') +) +``` + +## Usage \ No newline at end of file