diff --git a/.DS_Store b/.DS_Store index c16acd96..159ae8bc 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.github/.DS_Store b/.github/.DS_Store new file mode 100644 index 00000000..e78c6819 Binary files /dev/null and b/.github/.DS_Store differ diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index d371e859..d922dfc6 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -11,9 +11,7 @@ name: R-CMD-check jobs: R-CMD-check: runs-on: ${{ matrix.config.os }} - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - strategy: fail-fast: false matrix: @@ -44,14 +42,27 @@ jobs: extra-packages: any::rcmdcheck needs: check - - name: Regenerate Rcpp exports + - name: Install system dependencies + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libarmadillo-dev + + - name: Install RcppArmadillo + run: | + install.packages("RcppArmadillo") + shell: Rscript {0} + + - name: Check C++ compilation run: | - Rscript -e "Rcpp::compileAttributes()" - Rscript -e "devtools::document()" + Rcpp::compileAttributes() + devtools::document() + shell: Rscript {0} - uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true + args: 'c("--no-build-vignettes", "--no-manual")' - name: Show testthat output if: always() diff --git a/DESCRIPTION b/DESCRIPTION index 264150e0..a460a1d5 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -10,13 +10,12 @@ Maintainer: Rafael DanĂ­el Vias Description: Fits a discharge rating curve based on the power-law and the generalized power-law from data on paired stage and discharge measurements in a given river using a Bayesian hierarchical model as described in Hrafnkelsson et al. (2020) . Depends: R (>= 3.5.0) License: MIT + file LICENSE -LazyData: true RoxygenNote: 7.3.2 Imports: ggplot2, grid, gridExtra, - Rcpp, + Rcpp (>= 0.11.0), rlang, scales Suggests: @@ -30,5 +29,7 @@ URL: https://sor16.github.io/bdrc BugReports: https://github.com/sor16/bdrc/issues Encoding: UTF-8 LinkingTo: - Rcpp, - RcppArmadillo + Rcpp (>= 0.11.0), + RcppArmadillo (>= 0.2.35) +LazyData: yes +ByteCompile: TRUE diff --git a/NAMESPACE b/NAMESPACE index 7ef175ec..b29b4d10 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -43,7 +43,7 @@ export(plm) export(plm0) export(spread_draws) export(tournament) -importFrom(Rcpp,sourceCpp) +exportPattern("^[[:alpha:]]+") importFrom(ggplot2,"%+replace%") importFrom(ggplot2,aes) importFrom(ggplot2,autoplot) diff --git a/R/bdrc-package.R b/R/bdrc-package.R index 75fd0758..3cad8908 100644 --- a/R/bdrc-package.R +++ b/R/bdrc-package.R @@ -1,5 +1,4 @@ ## usethis namespace: start -#' @importFrom Rcpp sourceCpp #' @useDynLib bdrc, .registration = TRUE ## usethis namespace: end NULL diff --git a/src/Makevars b/src/Makevars index ce93e5a8..2edabeeb 100644 --- a/src/Makevars +++ b/src/Makevars @@ -1,3 +1,2 @@ -CXX_STD = CXX11 -PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS) +PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -DR_NO_REMAP +PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) diff --git a/src/Makevars.win b/src/Makevars.win index 4a28f0c9..2edabeeb 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -1,4 +1,2 @@ -CXX_STD = CXX11 -PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) +PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -DR_NO_REMAP PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) -USE_CXX14 = yes diff --git a/src/cppFunctions.h b/src/cppFunctions.h index 2c00bd30..abb4ffb7 100644 --- a/src/cppFunctions.h +++ b/src/cppFunctions.h @@ -2,8 +2,9 @@ #define CPP_FUNCTIONS_H #define _USE_MATH_DEFINES -#include + #include +#include // Help function declarations arma::mat matMult(const arma::mat& A, const arma::mat& B); diff --git a/src/gplm.cpp b/src/gplm.cpp index 582bbada..c2e910cf 100644 --- a/src/gplm.cpp +++ b/src/gplm.cpp @@ -5,14 +5,8 @@ #include "cppFunctions.h" -// [[Rcpp::depends(RcppArmadillo)]] -#include - -#define _USE_MATH_DEFINES -#include - using namespace Rcpp; -using namespace arma; + diff --git a/src/gplm0.cpp b/src/gplm0.cpp index 862cafbf..6590b014 100644 --- a/src/gplm0.cpp +++ b/src/gplm0.cpp @@ -5,14 +5,8 @@ #include "cppFunctions.h" -// [[Rcpp::depends(RcppArmadillo)]] -#include - -#define _USE_MATH_DEFINES -#include - using namespace Rcpp; -using namespace arma; + diff --git a/src/help_functions.cpp b/src/help_functions.cpp index 10175903..8d471a01 100644 --- a/src/help_functions.cpp +++ b/src/help_functions.cpp @@ -5,14 +5,8 @@ #include "cppFunctions.h" -// [[Rcpp::depends(RcppArmadillo)]] -#include - -#define _USE_MATH_DEFINES -#include - using namespace Rcpp; -using namespace arma; + // [[Rcpp::export]] @@ -59,9 +53,9 @@ arma::vec compute_w(const arma::mat& L, const arma::vec& y, const arma::mat& X, // [[Rcpp::export]] DataFrame get_MCMC_summary_cpp(const arma::mat& X, const Nullable& h ) { int n = X.n_rows; - mat summary_dat(n, 3); + arma::mat summary_dat(n, 3); for(int i = 0; i < n; ++i) { - rowvec row = X.row(i); + arma::rowvec row = X.row(i); row = sort(row); int size = row.n_elem; summary_dat(i, 0) = row(std::floor(0.025 * (size - 1))); diff --git a/src/plm.cpp b/src/plm.cpp index 8b430b2b..3b238941 100644 --- a/src/plm.cpp +++ b/src/plm.cpp @@ -5,14 +5,8 @@ #include "cppFunctions.h" -// [[Rcpp::depends(RcppArmadillo)]] -#include - -#define _USE_MATH_DEFINES -#include - using namespace Rcpp; -using namespace arma; + diff --git a/src/plm0.cpp b/src/plm0.cpp index 92ab8609..a33483de 100644 --- a/src/plm0.cpp +++ b/src/plm0.cpp @@ -5,14 +5,8 @@ #include "cppFunctions.h" -// [[Rcpp::depends(RcppArmadillo)]] -#include - -#define _USE_MATH_DEFINES -#include - using namespace Rcpp; -using namespace arma; +