Skip to content

Commit

Permalink
Merge pull request #22 from nutriverse:dev
Browse files Browse the repository at this point in the history
add tests and setup new website workflow; fix #19; fix #20; fix #21
  • Loading branch information
ernestguevarra authored Dec 18, 2024
2 parents 402f5d1 + 76aba3f commit 1c87877
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 19 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/netlify.yaml
Original file line number Diff line number Diff line change
@@ -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 '<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0;URL=/dev/index.html" /> <script language="javascript"> window.location.replace('/dev/index.html')</script></head></html>' > ./docs/index.html
- name: Deploy to Netlify
uses: nwtgck/[email protected]
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 }}
23 changes: 20 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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")
Expand Down
35 changes: 28 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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:

Expand All @@ -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, <https://nutriverse.io/anthrocheckr/>.
#> Anthropometric Measurement Standardisation Tests_. R
#> package version 0.0.9000,
#> <https://nutriverse.io/anthrocheckr/>.
#>
#> A BibTeX entry for LaTeX users is
#>
Expand Down
19 changes: 10 additions & 9 deletions pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
31 changes: 31 additions & 0 deletions tests/testthat/test-01_summary_measure.R
Original file line number Diff line number Diff line change
@@ -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"
)
})
3 changes: 3 additions & 0 deletions tests/testthat/test-04_calculate_team_tem.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Tests for calculate_team_tem -------------------------------------------------


2 changes: 2 additions & 0 deletions vignettes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.html
*.R
51 changes: 51 additions & 0 deletions vignettes/anthrocheckr.Rmd
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1c87877

Please sign in to comment.