diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml index bf69e22..d47af70 100644 --- a/.github/workflows/r.yml +++ b/.github/workflows/r.yml @@ -31,9 +31,9 @@ jobs: - {os: macOS-latest, r: 'devel', http-user-agent: 'release'} - {os: windows-latest, r: 'devel', http-user-agent: 'release'} # se older ubuntu to maximise backward compatibility - - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - - {os: ubuntu-latest, r: 'release'} - - {os: ubuntu-latest, r: 'oldrel'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel'} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} @@ -65,7 +65,7 @@ jobs: error-on: '"warning"' - uses: r-lib/actions/check-r-package@v2 - if: ${{ matrix.config.os != 'ubuntu-latest' || matrix.config.r != 're;ease' }} + if: ${{ matrix.config.os != 'ubuntu-latest' || matrix.config.r != 'release' }} with: upload-snapshots: false upload-results: false diff --git a/DESCRIPTION b/DESCRIPTION index d0ae353..1103232 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,8 @@ Package: epiworldR Type: Package Title: Fast Agent-Based Epi Models -Version: 0.6.0.0 +Version: 0.6.1.0 +Depends: R (>= 4.1.0) Authors@R: c( person(given="George", family="Vega Yon", role=c("aut"), email="g.vegayon@gmail.com", comment = c(ORCID = "0000-0002-3171-0844")), diff --git a/NEWS.md b/NEWS.md index 422dd9f..65fd86a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,11 @@ -# epiworldR 0.6.0.0 +# epiworldR 0.6.1.0 + +* Updates to reflect changes in the `epiworld` C++ library (mostly bug fixes) + +* Package now requires R version >=4.1.0, because it uses the pipe `|>` -## New features + +# epiworldR 0.6.0.0 * The package now includes the `LFMCMC` module that implements the likelihood-free Markov Chain Monte Carlo algorithm. This @@ -15,8 +20,6 @@ * The function `today()` returns the current day (step) of the simulation. -## Misc - * We changed the versioning system. To allow the R package to increase version number while preserving epiworld (C++) versioning, we added a fourth number that indicates R-only patches (similar to RcppArmadillo). diff --git a/inst/CITATION b/inst/CITATION index 8630f21..63dba0b 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -1,4 +1,4 @@ -year <- 2024 +year <- 2025 note <- sprintf("R package version %s", meta$Version) bibentry( diff --git a/inst/include/epiworld/epiworld.hpp b/inst/include/epiworld/epiworld.hpp index 6483465..52e4c14 100644 --- a/inst/include/epiworld/epiworld.hpp +++ b/inst/include/epiworld/epiworld.hpp @@ -19,7 +19,7 @@ /* Versioning */ #define EPIWORLD_VERSION_MAJOR 0 #define EPIWORLD_VERSION_MINOR 6 -#define EPIWORLD_VERSION_PATCH 0 +#define EPIWORLD_VERSION_PATCH 1 static const int epiworld_version_major = EPIWORLD_VERSION_MAJOR; static const int epiworld_version_minor = EPIWORLD_VERSION_MINOR; diff --git a/inst/include/epiworld/math/lfmcmc/lfmcmc-meat-print.hpp b/inst/include/epiworld/math/lfmcmc/lfmcmc-meat-print.hpp index 6a658ab..c526a6c 100755 --- a/inst/include/epiworld/math/lfmcmc/lfmcmc-meat-print.hpp +++ b/inst/include/epiworld/math/lfmcmc/lfmcmc-meat-print.hpp @@ -93,7 +93,16 @@ inline void LFMCMC::print(size_t burnin) const for (auto & n : summ_params) { - int tmp_nchar = std::floor(std::log10(std::abs(n))); + int tmp_nchar; + + if (std::abs(n) < 1) { + // std::log10(<1) will return negative number + // std::log10(0) will return -inf and throw a runtime error + tmp_nchar = 0; + } else { + tmp_nchar = std::floor(std::log10(std::abs(n))); + } + if (nchar_par_num < tmp_nchar) nchar_par_num = tmp_nchar; } @@ -161,7 +170,15 @@ inline void LFMCMC::print(size_t burnin) const int nchar = 0; for (auto & s : summ_stats) { - int tmp_nchar = std::floor(std::log10(std::abs(s))); + int tmp_nchar; + if (std::abs(s) < 1) { + // std::log10(<1) will return negative number + // std::log10(0) will return -inf and throw a runtime error + tmp_nchar = 0; + } else { + tmp_nchar = std::floor(std::log10(std::abs(s))); + } + if (nchar < tmp_nchar) nchar = tmp_nchar; }