Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #19 from nlmixr2/cran-fixes
Browse files Browse the repository at this point in the history
Cran fixes
  • Loading branch information
mattfidler authored Nov 29, 2023
2 parents a513890 + baf9397 commit 41e1c0a
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 23 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: rxode2random
Title: Random Number Generation Functions for 'rxode2'
Version: 2.0.11.9001
Version: 2.0.12
Authors@R: c(
person("Matthew L.", "Fidler", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-8538-6691")),
Expand All @@ -22,12 +22,12 @@ Imports:
Rcpp,
checkmate,
lotri,
rxode2parse (> 2.0.13)
rxode2parse (>= 2.0.17)
Suggests:
testthat (>= 3.0.0)
LinkingTo:
sitmo,
rxode2parse (>= 2.0.12),
rxode2parse (>= 2.0.17),
Rcpp,
RcppArmadillo,
BH
Expand Down
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# rxode2random (development version)
# rxode2random 2.0.12

- Added function `dfWishart` which gives (by simulation) an
approximation of the degrees of freedom of a Wishart to match a
Expand All @@ -7,6 +7,9 @@
- Added function `swapMatListWithCube` which swaps omegaList with
omegaCube values

- Ensure that the outputs are integers (instead of long integers) as
requested by CRAN for some checking functions.

# rxode2random 2.0.11

- Fix qassert LTO
Expand Down
2 changes: 1 addition & 1 deletion R/dfWishart.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ dfWishart <- function(omega, n, rse, upper, totN=1000, diag=TRUE, seed=1234) {
.lower <- .d[1] + 3.1
.upper <- upper
rxWithSeed(seed, {
uniroot(dfWishartCalcRse, lower=.lower, upper=.upper, omega=omega, totN=totN, rse=rse, diag=diag)
stats::uniroot(dfWishartCalcRse, lower=.lower, upper=.upper, omega=omega, totN=totN, rse=rse, diag=diag)
})
}
#' Swaps the matrix list with a cube
Expand Down
18 changes: 9 additions & 9 deletions R/rxrandom.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' `rxnorm` simulates using the threefry sitmo generator;
#'
#' @return normal random number deviates
#'
#'
#' @importFrom Rcpp sourceCpp
#' @importFrom stats setNames
#' @useDynLib rxode2random, .registration=TRUE
Expand Down Expand Up @@ -69,7 +69,7 @@ rxpois <- function(lambda, n = 1L, ncores = 1L) {
#' rxt(df = 3, n = 10, ncores = 2) # You can parallelize the simulation using openMP
#'
#' rxt(4) ## The first argument is the df parameter
#'
#'
#' @export
rxt <- function(df, n = 1L, ncores = 1L) {
checkmate::assertNumeric(df, len = 1, lower = 0)
Expand All @@ -94,7 +94,7 @@ rxt <- function(df, n = 1L, ncores = 1L) {
#' rxunif(min = 0, max = 4, n = 10, ncores = 2) # You can parallelize the simulation using openMP
#'
#' rxunif()
#'
#'
#' @export
rxunif <- function(min = 0, max = 1, n = 1L, ncores = 1L) {
checkmate::assertNumeric(min, len = 1)
Expand Down Expand Up @@ -708,10 +708,10 @@ rxRmvn <- function(n, mu = NULL, sigma, lower = -Inf, upper = Inf, ncores = 1, i
#' `omega` matrix of standard deviations
#'
#' @param omegaIsChol is an indicator of if the omega matrix is in
#' the Cholesky decomposition. This is only used when code{type="invWishart"}
#' the Cholesky decomposition. This is only used when \code{type="invWishart"}
#'
#' @param returnChol Return the Cholesky decomposition of the
#' covariance matrix sample. This is only used when code{type="invWishart"}
#' covariance matrix sample. This is only used when \code{type="invWishart"}
#'
#' @param diagXformType Diagonal transformation type. These could be:
#'
Expand Down Expand Up @@ -1039,11 +1039,11 @@ rxWithPreserveSeed <- function(code) {
#'
#' @return md5 hash of rxode2random revision
#' @author Matthew L. Fidler
#' @export
#' @export
#' @examples
#' rxode2randomMd5()
rxode2randomMd5 <- function() {
rxode2random.md5
rxode2random.md5
}


Expand Down Expand Up @@ -1072,13 +1072,13 @@ rxode2randomMd5 <- function() {

#' Expand parameters
#'
#'
#'
#' @param object rxode2 model variables object
#' @param params parameters to expand
#' @param events event table to help with the expansion
#' @param control control structure to help with the parameter generation
#' @return Expanded parameters for simulation
#' @export
#' @export
#' @author Matthew L. Fidler
#' @keywords internal
.expandPars <- function(object, params, events, control) {
Expand Down
12 changes: 12 additions & 0 deletions R/zzzz.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.rxode2parseVersion <- utils::packageVersion("rxode2parse")
.onLoad <- function(libname, pkgname) {
if (!identical(.rxode2parseVersion, utils::packageVersion("rxode2parse"))) {
stop("rxode2 compiled with rxode2parse '", as.character(.rxode2parseVersion),
"' but rxode2parse '", as.character(utils::packageVersion("rxode2parse")),
"' is loaded\nRecompile rxode2 with the this version of rxode2parse",
call. = FALSE
)
} else {
requireNamespace("rxode2parse", quietly=TRUE)
}
}
4 changes: 2 additions & 2 deletions man/cvPost.Rd

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

2 changes: 1 addition & 1 deletion man/invWR1d.Rd

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

12 changes: 6 additions & 6 deletions src/checkmate_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,28 @@ void qstrict0(SEXP nn, const char *what){
R_xlen_t pos = find_missing_string(nn);
if (pos > 0) {
UNPROTECT(1);
Rf_errorcall(R_NilValue, "Must have %s, but is NA at position %i", what, pos);
Rf_errorcall(R_NilValue, "Must have %s, but is NA at position %i", what, (int)(pos));
}
pos = any_duplicated(nn, FALSE);

if (pos > 0) {
UNPROTECT(1);
Rf_errorcall(R_NilValue, "Must have unique %s, but element %i is duplicated", what, pos);
Rf_errorcall(R_NilValue, "Must have unique %s, but element %i is duplicated", what, (int)(pos));
}

if (isNull(nn)) {
UNPROTECT(1);
Rf_errorcall(R_NilValue, "Must have %s", what);
}
pos = any_duplicated(nn, FALSE);
if (pos > 0){
UNPROTECT(1);
Rf_errorcall(R_NilValue, "Must have unique %s, but element %i is duplicated", what, pos);
Rf_errorcall(R_NilValue, "Must have unique %s, but element %i is duplicated", what, (int)(pos));
}
pos = check_strict_names(nn);
if (pos > 0){
UNPROTECT(1);
Rf_errorcall(R_NilValue, "Must have %s according to R's variable naming conventions, but element %i does not comply", what, pos);
Rf_errorcall(R_NilValue, "Must have %s according to R's variable naming conventions, but element %i does not comply", what, (int)(pos));
}
UNPROTECT(1);
}
Expand Down

0 comments on commit 41e1c0a

Please sign in to comment.