Skip to content

Commit

Permalink
Fix CRAN check issues. Update version number. Re-generate documentati…
Browse files Browse the repository at this point in the history
…on. Added cran-check github action to test for various configurations
  • Loading branch information
sciome-bot committed May 17, 2024
1 parent fa2ce2f commit c6a24f6
Show file tree
Hide file tree
Showing 161 changed files with 45,580 additions and 47,028 deletions.
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
^\.github$
^\.log$
^CHANGELOG\.md$
^cran-comments\.md$
^cran-comments\.md$
^llvm/
95 changes: 83 additions & 12 deletions .github/workflows/cran-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,102 @@ permissions:
contents: read

jobs:
cran-check:
runs-on: ubuntu-latest
env:
_R_CHECK_DONTTEST_EXAMPLES_: false
cran-check:
strategy:
fail-fast: false
matrix:
include: [
{os: "ubuntu-latest", r: "release", compiler_version: 15},
{os: "ubuntu-latest", r: "devel", compiler_version: 15},
{os: "windows-latest", r: "release", compiler_version: 15},
{os: "windows-latest", r: "devel", compiler_version: 15},
{os: "macos-latest", r: "release", compiler_version: 15},
{os: "macos-latest", r: "devel", compiler_version: 15},
{os: "macos-latest", r: "release", compiler_version: 14},
]
# os: [ubuntu-latest]
# r: ['release']
# compiler: ['clang']
# compiler_version: [14, 17]
runs-on: ${{matrix.os}}
name: ${{ matrix.os }}_${{ matrix.r}}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{matrix.r}}
- uses: awalsh128/cache-apt-pkgs-action@latest
if: runner.os == 'Linux'
with:
packages: cmake cmake-data dh-elpa-helper libcmark-gfm-extensions0.29.0.gfm.3 libcmark-gfm0.29.0.gfm.3 libcurl4-openssl-dev libjsoncpp25 librhash0 pandoc pandoc-data
packages: |
cmake cmake-data gsl dh-elpa-helper libcmark-gfm-extensions0.29.0.gfm.3
libcmark-gfm0.29.0.gfm.3 libcurl4-openssl-dev libjsoncpp25 librhash0
pandoc pandoc-data texlive-latex-base texlive-latex-recommended
texlive-fonts-recommended
version: 1.0
- name: Restore R package cache
- name: Restore R package cache (Linux)
if: runner.os == 'Linux'
id: cache-packages
uses: actions/cache@v4
with:
key: r-${{ hashFiles('DESCRIPTION') }}
path: ${{ env.R_LIBS_USER }}
- name: Install GSL (macOS)
if: runner.os == 'macOs'
run: |
brew install gsl openssl
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck, any::roxygen2
needs: check
- name: Document
run: roxygen2::roxygenise()
shell: Rscript {0}
- uses: r-lib/actions/check-r-package@v2
- name: Setup compiler
if: runner.os == 'macOs'
uses: KyleMayes/install-llvm-action@v2
with:
version: ${{matrix.compiler_version}}
env: true
directory: ".."
- name: Setup Xcode
if: runner.os == 'macOs'
uses: maxim-lobanov/setup-xcode@v1
with:
args: 'c("--no-manual", "--as-cran")'
error-on: '"error"'
xcode-version: latest
- name: Build and Check ToxicR
if: runner.os != 'Windows'
run: |
R CMD build .
file config.log
cat config.log
r_output=$(R CMD build .)
echo "$r_output"
package_name=$(echo "$r_output" | sed -n "s/.*building ‘\([^’]*\.tar\.gz\)’.*/\1/p")
echo "$package_name"
R CMD check --as-cran --no-manual $package_name
file ToxicR.Rcheck/00install.log
file ToxicR/ToxicR.Rcheck/00install.log
cat ToxicR.Rcheck/00install.log
cat ToxicR.Rcheck/00check.log
shell: bash
working-directory: "."
- name: Build and Check ToxicR
if: runner.os == 'Windows'
run: |
r_output=$(R CMD build .)
echo "$r_output"
package_name=$(echo "$r_output" | sed -n "s/.*building '\([^']*\.tar\.gz\)'.*/\1/p")
echo "$package_name"
R CMD check --as-cran --no-manual $package_name
file ToxicR.Rcheck/00install.log
file ToxicR/ToxicR.Rcheck/00install.log
cat ToxicR.Rcheck/00install.log
cat ToxicR.Rcheck/00check.log
shell: bash
working-directory: "."
# - name: Show testthat output
# if: always()
# run: |
# echo ::group::Show testthat output
# find check -name 'testthat.Rout*' -exec cat '{}' \; || true
# echo ::endgroup::
# shell: bash
# working-directory: "."
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: ToxicR
Type: Package
Title: Analyzing Toxicology Dose-Response Data
Version: 23.10.1.1.3
Date: 2024-04-12
Version: 23.10.1.2.0
Date: 2024-05-17
Authors@R:
c(
person(given = "Matt",
Expand All @@ -18,8 +18,7 @@ Authors@R:
role = "ctb"),
person(given = "Shail",
family = "Choksi",
role = "ctb",
comment = "Setup github actions for automated tests and builds."),
role = "ctb"),
person(given = "Brian",
family = "Kidd",
role = "ctb"),
Expand Down Expand Up @@ -89,6 +88,8 @@ Packaged: 2024-04-12 20:00:54 UTC; shail.choksi
Author: Matt Wheeler [aut, cre] (<https://orcid.org/0000-0002-8242-2391>),
Sooyeong Lim [aut],
Eric Wimberly [ctb],
Shail Choksi [ctb],
Brian Kidd [ctb],
Keith Shockley [com],
Jennifer Fostel [com],
Lonlong Yang [ctb] (Modfied Cochran-Armitage test.),
Expand Down
2 changes: 1 addition & 1 deletion R/MAdensity_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#' model <- ma_continuous_fit(doses, y,
#' fit_type = "mcmc", BMR_TYPE = "sd", BMR = 1
#' )
#' MAdensity_plot(model)
#' try(MAdensity_plot(model))
#' }
#' @export
MAdensity_plot <- function(A) {
Expand Down
2 changes: 1 addition & 1 deletion R/opening_messages.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
| |/ _ \\ \\/ / |/ __| _ /
| | (_) > <| | (__| | \\ \\
|_|\\___/_/\\_\\_|\\___|_| \\_\\
23.10.1.1.3
23.10.1.2.0
___
| |
/ \\ ____()()
Expand Down
4 changes: 4 additions & 0 deletions R/update_ToxicR.R
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ update_ToxicR <- function(force = TRUE, upgrade_other_pkg = FALSE, confirm = TRU
#' @return there will be no output from this function. Rather, packages
#' given as inputs to the function will be installed, loaded, and attached.
#'
#' @examples
#' \dontrun{
#' try(prep("data.table"))
#' }
prep <- function(..., pkg_names_as_object = FALSE, silent_if_successful = FALSE, silent_load_pkgs = FALSE) {
arg_list <- as.list(match.call(expand.dots = FALSE))[["..."]]
if ("..." %in% names(arg_list)) {
Expand Down
2 changes: 1 addition & 1 deletion man/MAdensity_plot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion man/ntp_dunnett.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion man/ntp_jonckeere.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions man/prep.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions man/single_continuous_fit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions src/Makevars.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
PKG_CXXFLAGS= -I./code_base -I./include @OPENMP@ @NLOPT_CPPFLAGS@ @GSL_CPPFLAGS@ -DR_COMPILATION -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS -DEIGEN_WARNINGS_DISABLED
PKG_CXXFLAGS= -I./code_base -I./include @OPENMP@ @NLOPT_CPPFLAGS@ @GSL_CPPFLAGS@ -DR_COMPILATION
PKG_LIBS= $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) @NLOPT_LIBS@ @GSL_LIBS@ @OPENMP@
CXX14FLAGS= -Wno-ignored-attributes -Wno-sign-compare -Wno-unused -Wno-builtin-macro-redefined
CXX11FLAGS= -Wno-ignored-attributes -Wno-sign-compare -Wno-unused -Wno-builtin-macro-redefined

# CXXFLAGS+=-Wno-ignored-attributes -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
# Include all C++ files in src/ and its subdirectories
SOURCES=@SRC_SOURCES@ @SUBDIR_SOURCES@

Expand Down
8 changes: 4 additions & 4 deletions src/Makevars.ucrt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PKG_CXXFLAGS= -I./code_base -I./include $(SHLIB_OPENMP_CXXFLAGS) -I$(R_TOOLS_SOFT)/include/nlopt -I$(R_TOOLS_SOFT)/include/gsl -DR_COMPILATION -ftree-vectorize -Os -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS -DEIGEN_WARNINGS_DISABLED
PKG_LIBS= $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS) -lgsl -lgslcblas -lnlopt
# CXX14FLAGS= -Wno-ignored-attributes -Wno-sign-compare -Wno-unused -Wno-builtin-macro-redefined
# CXX11FLAGS= -Wno-ignored-attributes -Wno-sign-compare -Wno-unused -Wno-builtin-macro-redefined
PKG_CXXFLAGS+=-I./code_base -I./include $(SHLIB_OPENMP_CXXFLAGS) -I$(R_TOOLS_SOFT)/include/nlopt -I$(R_TOOLS_SOFT)/include/gsl -DR_COMPILATION -ftree-vectorize -Os
PKG_LIBS+=$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS) -lgsl -lgslcblas -lnlopt
# CXXFLAGS+=-Wno-ignored-attributes -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS


POLYK = $(wildcard polyK/*.cpp)
MAIN = $(wildcard *.cpp)
Expand Down
8 changes: 4 additions & 4 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PKG_CPPFLAGS= -I../windows/gsl-2.7/include -I../windows/nlopt-2.7.1/include -I./ -I./code_base -I./include -DR_COMPILATION -ftree-vectorize -Os -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS -DEIGEN_WARNINGS_DISABLED
PKG_LIBS= -L../windows/nlopt-2.7.1/lib${R_ARCH}${CRT} -L../windows/gsl-2.7/lib${R_ARCH}${CRT} -lgsl -lgslcblas -lnlopt
PKG_CPPFLAGS+=-I../windows/gsl-2.7/include -I../windows/nlopt-2.7.1/include -I./ -I./code_base -I./include -DR_COMPILATION -ftree-vectorize -Os
PKG_LIBS+=-L../windows/nlopt-2.7.1/lib${R_ARCH}${CRT} -L../windows/gsl-2.7/lib${R_ARCH}${CRT} -lgsl -lgslcblas -lnlopt

# CXXFLAGS+=-Wno-ignored-attributes -DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS

# CXX14FLAGS= -Wno-ignored-attributes -Wno-sign-compare -Wno-unused -Wno-builtin-macro-redefined
# CXX11FLAGS= -Wno-ignored-attributes -Wno-sign-compare -Wno-unused -Wno-builtin-macro-redefined

POLYK = $(wildcard polyK/*.cpp)
MAIN = $(wildcard *.cpp)
Expand Down
77 changes: 41 additions & 36 deletions src/code_base/DichGammaBMD_NC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,62 @@

#ifdef R_COMPILATION
// necessary things to run in R
#include <RcppGSL.h>
#ifdef ToxicR_DEBUG
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wignored-attributes"
#include <RcppEigen.h>
#pragma GCC diagnostic pop
#else
#include <RcppEigen.h>
#endif
#include <RcppGSL.h>
#else
#include <Eigen/Dense>
#endif

#include <gsl/gsl_blas.h>
#include <gsl/gsl_cdf.h>
#include <gsl/gsl_ieee_utils.h>
#include <gsl/gsl_integration.h>
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_test.h>
#include <gsl/gsl_ieee_utils.h>
#include <gsl/gsl_integration.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_blas.h>
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_cdf.h>

double GAMMA_BMD_EXTRA_NC_INEQUALITY(Eigen::MatrixXd theta, void *data)
{
log_gamma_inequality *M = (log_gamma_inequality *)data;
double inequality = M->inequality;
double BMD = M->BMD;
double BMR = M->BMR;
bool geq = M->geq;

double g = GAMMA_G(theta(0, 0));
double a = GAMMA_A(theta(1, 0));
double Z = GAMMA_EXTRA_Z(g, a, BMR); // note BMD is a placeholder
Z = Z / BMD;
double rV = 0.0;
rV = (geq) ? inequality - Z : Z - inequality;
return rV;
double GAMMA_BMD_EXTRA_NC_INEQUALITY(Eigen::MatrixXd theta, void *data) {
log_gamma_inequality *M = (log_gamma_inequality *)data;
double inequality = M->inequality;
double BMD = M->BMD;
double BMR = M->BMR;
bool geq = M->geq;

double g = GAMMA_G(theta(0, 0));
double a = GAMMA_A(theta(1, 0));
double Z = GAMMA_EXTRA_Z(g, a, BMR); // note BMD is a placeholder
Z = Z / BMD;
double rV = 0.0;
rV = (geq) ? inequality - Z : Z - inequality;
return rV;
}

double GAMMA_BMD_ADDED_NC_INEQUALITY(Eigen::MatrixXd theta, void *data)
{
log_gamma_inequality *M = (log_gamma_inequality *)data;
double inequality = M->inequality;
double BMD = M->BMD;
double BMR = M->BMR;
bool geq = M->geq;
double GAMMA_BMD_ADDED_NC_INEQUALITY(Eigen::MatrixXd theta, void *data) {
log_gamma_inequality *M = (log_gamma_inequality *)data;
double inequality = M->inequality;
double BMD = M->BMD;
double BMR = M->BMR;
bool geq = M->geq;

double g = GAMMA_G(theta(0, 0));
double a = GAMMA_A(theta(1, 0));
double g = GAMMA_G(theta(0, 0));
double a = GAMMA_A(theta(1, 0));

double Z = GAMMA_ADDED_Z(g, a, BMR);
Z = Z / BMD;
double rV = 0.0;
double Z = GAMMA_ADDED_Z(g, a, BMR);
Z = Z / BMD;
double rV = 0.0;

rV = (geq) ? inequality - Z : Z - inequality;
rV = (geq) ? inequality - Z : Z - inequality;

return rV;
return rV;
}
Loading

0 comments on commit c6a24f6

Please sign in to comment.