From bb11188dffec5a55f7fd7ad86a0e3bc4a837e232 Mon Sep 17 00:00:00 2001 From: James Steven Jenkins Date: Wed, 5 Mar 2025 17:57:51 -0500 Subject: [PATCH 01/10] begin development branch 0.3.1.9000-dev --- DESCRIPTION | 2 +- NEWS.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6352ddd..4066924 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: massProps Title: Calculate Mass Properties and Uncertainties of Tree Structures -Version: 0.3.1 +Version: 0.3.1.9000 Authors@R: person(given=c("James", "Steven"), family="Jenkins", email = "sjenkins@studioj.us", diff --git a/NEWS.md b/NEWS.md index 411b225..da67d64 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,5 @@ +# massProps (development version) + # massProps 0.3.1 * Examples made smaller to avoid CRAN runtime violations From 61ac59f10382e47a1c337d8de39cce311a359c19 Mon Sep 17 00:00:00 2001 From: James Steven Jenkins Date: Thu, 6 Mar 2025 11:59:04 -0500 Subject: [PATCH 02/10] issue 41 complete --- NEWS.md | 2 ++ vignettes/massProps.Rmd | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index da67d64..bdaf5b5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # massProps (development version) +* Invocation instructions in vignette cleaned up (#41) + # massProps 0.3.1 * Examples made smaller to avoid CRAN runtime violations diff --git a/vignettes/massProps.Rmd b/vignettes/massProps.Rmd index 88427fe..44ab29f 100644 --- a/vignettes/massProps.Rmd +++ b/vignettes/massProps.Rmd @@ -141,9 +141,7 @@ The tree is an `igraph::graph` with vertices named by identifiers in the mass pr ## Invocation ```{r setup} -library(rollupTree) library(massProps) -suppressPackageStartupMessages({library(igraph)}) ``` Suppose we have the following mass properties table: @@ -159,7 +157,7 @@ test_tree ``` ```{r echo = FALSE} -plot(test_tree,layout=layout_as_tree(test_tree, 2, mode="in"), vertex.shape = 'none', edge.arrow.mode = 0) +igraph::plot.igraph(test_tree,layout=igraph::layout_as_tree(test_tree, 2, mode="in"), vertex.shape = 'none', edge.arrow.mode = 0) ``` Then we can compute mass properties for non-leaf elements by calling `rollup_mass_props()`: @@ -189,7 +187,7 @@ na_mass_props_and_unc <- function(d, t, v) { na_mass_props_and_unc_update <- function(d, t, s) { update_mass_props_and_unc(d, t, s, override = na_mass_props_and_unc) } -sawe_input <- rollup(sawe_tree, sawe_table, update = na_mass_props_and_unc_update, validate_ds = validate_mass_props_and_unc_table) +sawe_input <- rollupTree::rollup(sawe_tree, sawe_table, update = na_mass_props_and_unc_update, validate_ds = validate_mass_props_and_unc_table) ``` ```{r} @@ -1098,7 +1096,7 @@ The SAWE reference provides computed results for their example (excluding radii # Performance Evaluation ```{r echo = FALSE} -mp_tree_depth <- max(dfs(mp_tree, 2, mode = "in", order=FALSE, dist=TRUE)$dist) + 1 +mp_tree_depth <- max(igraph::dfs(mp_tree, 2, mode = "in", order=FALSE, dist=TRUE)$dist) + 1 nv <- length(igraph::V(mp_tree)) ne <- length(igraph::E(mp_tree)) nl <- length(which(igraph::degree(mp_tree, mode="in") == 0)) From 6bcd1012b66f030a6b69953494e34d05adb0edca Mon Sep 17 00:00:00 2001 From: James Steven Jenkins Date: Fri, 14 Mar 2025 22:41:28 -0400 Subject: [PATCH 03/10] sigma ROG covariance exposition cleaned up --- vignettes/massProps.Rmd | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/vignettes/massProps.Rmd b/vignettes/massProps.Rmd index 44ab29f..38a2d86 100644 --- a/vignettes/massProps.Rmd +++ b/vignettes/massProps.Rmd @@ -746,12 +746,14 @@ Therefore, $$ \begin{align} \sigma_{\Ixx w} & = E \left[ \left( W - E[W] \right) \left( X - E[X] \right)\right] \\ - & = E \left[ \left( \sum_{i=1}^{n} {\epsilon_w}_i \right) - \left( \sum_{i=1}^{n} \left\{ {\epsilon_{\Ixx}}_i - + {\epsilon_w}_i \left[ \left( {y}_i - \bar{y} \right)^2 + \left( {z}_i - \bar{z} \right)^2 \right] \right\} \right) \right] \\ - & = E \left[ \sum_{i=1}^{n} {\epsilon_w}^2_i \left( \left( {y}_i - \bar{y} \right)^2 + \left( {z}_i - \bar{z} \right)^2 \right) \right] \\ - & = \sum_{i=1}^{n} E \left[ {\epsilon_w}^2_i \right] \left( \left( {y}_i - \bar{y} \right)^2 + \left( {z}_i - \bar{z} \right)^2 \right) \\ - & = \sum_{i=1}^{n} {\sigma_w}^2_i \left( \left( {y}_i - \bar{y} \right)^2 + \left( {z}_i - \bar{z} \right)^2 \right) \\ + & = E \left[ \sum_{i=1}^{n} {\epsilon_w}_i + \sum_{j=1}^{n} \left\{ {\epsilon_{\Ixx}}_j + + {\epsilon_w}_j \left[ \left( {y}_j - \bar{y} \right)^2 + \left( {z}_j - \bar{z} \right)^2 \right] \right\} \right] \\ + & = \sum_{i=1}^{n} + \sum_{j=1}^{n} E \left[ {\epsilon_w}_i \left\{ {\epsilon_{\Ixx}}_j + + {\epsilon_w}_j \left[ \left( {y}_j - \bar{y} \right)^2 + \left( {z}_j - \bar{z} \right)^2 \right] \right\} \right] \\ + & = \sum_{i=1}^{n} E \left[ {\epsilon_w}^2_i \right] \left[ \left( {y}_i - \bar{y} \right)^2 + \left( {z}_i - \bar{z} \right)^2 \right] \\ + & = \sum_{i=1}^{n} {\sigma_w}^2_i \left[ \left( {y}_i - \bar{y} \right)^2 + \left( {z}_i - \bar{z} \right)^2 \right] \\ \end{align} $$ From 031a3522f23de78d1950377d239ff6be47259493 Mon Sep 17 00:00:00 2001 From: James Steven Jenkins Date: Sat, 15 Mar 2025 16:08:55 -0400 Subject: [PATCH 04/10] NEWS.md updated --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index bdaf5b5..fa1a5fd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ * Invocation instructions in vignette cleaned up (#41) +* Covariance exposition for RoG uncertainty clarified (#43) + # massProps 0.3.1 * Examples made smaller to avoid CRAN runtime violations From 32eef78677f85852470d68f82207f82b91a5c4b6 Mon Sep 17 00:00:00 2001 From: James Steven Jenkins Date: Thu, 6 Mar 2025 11:59:04 -0500 Subject: [PATCH 05/10] issue 41 complete --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index fa1a5fd..72ed4a9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,8 @@ * Covariance exposition for RoG uncertainty clarified (#43) +* Invocation instructions in vignette cleaned up (#41) + # massProps 0.3.1 * Examples made smaller to avoid CRAN runtime violations From 275660184d12d025f0cb67b1dc099bbb80cd2635 Mon Sep 17 00:00:00 2001 From: James Steven Jenkins Date: Sun, 16 Mar 2025 08:45:59 -0400 Subject: [PATCH 06/10] duplicate lines in NEWS removed --- NEWS.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 72ed4a9..fa1a5fd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,8 +4,6 @@ * Covariance exposition for RoG uncertainty clarified (#43) -* Invocation instructions in vignette cleaned up (#41) - # massProps 0.3.1 * Examples made smaller to avoid CRAN runtime violations From 2f0500f1512380acb2517155ff44ffd84f9ba7f7 Mon Sep 17 00:00:00 2001 From: James Steven Jenkins Date: Sun, 16 Mar 2025 09:07:48 -0400 Subject: [PATCH 07/10] fix complete --- NEWS.md | 6 ++++-- R/radii.R | 2 +- vignettes/massProps.Rmd | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index fa1a5fd..e3f77d8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,10 @@ # massProps (development version) -* Invocation instructions in vignette cleaned up (#41) +* Invocation instructions in vignette cleaned up (#41). -* Covariance exposition for RoG uncertainty clarified (#43) +* Covariance exposition for RoG uncertainty clarified (#43). + +* Initialization in rollup_radii_of_gyration_unc() cleaned up (#44). # massProps 0.3.1 diff --git a/R/radii.R b/R/radii.R index bb6fb89..5145a8a 100644 --- a/R/radii.R +++ b/R/radii.R @@ -71,7 +71,7 @@ rollup_radii_of_gyration_unc <- function(tree, df) { }, sources ), - init <- c(0, 0, 0) + init = c(0, 0, 0) ) ) / 2 set_radii_of_gyration_unc(ds, target, amp) diff --git a/vignettes/massProps.Rmd b/vignettes/massProps.Rmd index 38a2d86..948a60e 100644 --- a/vignettes/massProps.Rmd +++ b/vignettes/massProps.Rmd @@ -804,7 +804,7 @@ The corresponding R code is }, sources ), - init <- c(0, 0, 0) + init = c(0, 0, 0) ) ) / 2 ``` From 93e432653621a4b944b4d0232ae4a11eff7bde40 Mon Sep 17 00:00:00 2001 From: James Steven Jenkins Date: Sun, 16 Mar 2025 11:42:47 -0400 Subject: [PATCH 08/10] igraph loading fix for vignette --- NEWS.md | 2 ++ vignettes/massProps.Rmd | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/NEWS.md b/NEWS.md index e3f77d8..a1b1900 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,8 @@ * Initialization in rollup_radii_of_gyration_unc() cleaned up (#44). +* Library loading fix for vignette (#48). + # massProps 0.3.1 * Examples made smaller to avoid CRAN runtime violations diff --git a/vignettes/massProps.Rmd b/vignettes/massProps.Rmd index 948a60e..d9e7b54 100644 --- a/vignettes/massProps.Rmd +++ b/vignettes/massProps.Rmd @@ -152,7 +152,11 @@ test_table Suppose we also have this tree: +```{r echo = FALSE} +suppressPackageStartupMessages({library(igraph)}) +``` ```{r} +library(igraph) test_tree ``` From d0fe5c31f50a62c0fe2d95f23d63571e27c8437d Mon Sep 17 00:00:00 2001 From: James Steven Jenkins Date: Sun, 16 Mar 2025 11:43:25 -0400 Subject: [PATCH 09/10] NEWS tweak --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index a1b1900..2f661fd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,7 +6,7 @@ * Initialization in rollup_radii_of_gyration_unc() cleaned up (#44). -* Library loading fix for vignette (#48). +* igraph loading fix for vignette (#48). # massProps 0.3.1 From b8909a53b601a246935ee24e05621fd741891be3 Mon Sep 17 00:00:00 2001 From: James Steven Jenkins Date: Fri, 28 Mar 2025 15:37:34 -0400 Subject: [PATCH 10/10] badges and actions for check and code coverage --- .Rbuildignore | 1 + .github/workflows/R-CMD-check.yaml | 51 +++++++++++++++++++++++ .github/workflows/test-coverage.yaml | 62 ++++++++++++++++++++++++++++ README.Rmd | 3 ++ README.md | 5 +++ codecov.yml | 14 +++++++ 6 files changed, 136 insertions(+) create mode 100644 .github/workflows/R-CMD-check.yaml create mode 100644 .github/workflows/test-coverage.yaml create mode 100644 codecov.yml diff --git a/.Rbuildignore b/.Rbuildignore index aa8d6e8..e00a0e4 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -12,3 +12,4 @@ ^README\.Rmd$ ^CRAN-SUBMISSION$ ^revdep$ +^codecov\.yml$ diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..562fe0f --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,51 @@ +# 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: + +name: R-CMD-check.yaml + +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 + + - 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 + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 0000000..0ab748d --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,62 @@ +# 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: + +name: test-coverage.yaml + +permissions: read-all + +jobs: + test-coverage: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v4 + + - 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, any::xml2 + needs: coverage + + - name: Test coverage + run: | + cov <- covr::package_coverage( + quiet = FALSE, + clean = FALSE, + install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") + ) + print(cov) + covr::to_cobertura(cov) + shell: Rscript {0} + + - uses: codecov/codecov-action@v5 + with: + # Fail if error if not on PR, or if on PR and token is given + fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }} + files: ./cobertura.xml + plugins: noop + disable_search: true + token: ${{ secrets.CODECOV_TOKEN }} + + - 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@v4 + with: + name: coverage-test-failures + path: ${{ runner.temp }}/package diff --git a/README.Rmd b/README.Rmd index 8ea9d6c..60f66f6 100644 --- a/README.Rmd +++ b/README.Rmd @@ -17,6 +17,9 @@ knitr::opts_chunk$set( # massProps +[![CRAN status](https://www.r-pkg.org/badges/version/massProps)](https://CRAN.R-project.org/package=massProps) +[![R-CMD-check](https://github.com/jsjuni/massProps/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jsjuni/massProps/actions/workflows/R-CMD-check.yaml) +[![Codecov test coverage](https://codecov.io/gh/jsjuni/massProps/graph/badge.svg)](https://app.codecov.io/gh/jsjuni/massProps) The `massProps` package extends `rollupTree` with functions to recursively calculate mass properties (and optionally, their uncertainties) for arbitrary composition trees. Formulas implemented are described in a technical paper published by the Society of Allied Weight Engineers [@zimmerman:05:sawe]. diff --git a/README.md b/README.md index 39b8106..283f7a1 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,11 @@ +[![CRAN +status](https://www.r-pkg.org/badges/version/massProps)](https://CRAN.R-project.org/package=massProps) +[![R-CMD-check](https://github.com/jsjuni/massProps/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jsjuni/massProps/actions/workflows/R-CMD-check.yaml) +[![Codecov test +coverage](https://codecov.io/gh/jsjuni/massProps/graph/badge.svg)](https://app.codecov.io/gh/jsjuni/massProps) The `massProps` package extends `rollupTree` with functions to diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..04c5585 --- /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