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

Commit

Permalink
Formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Jan 14, 2024
1 parent c3a0a8e commit 99cb812
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 29 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# rxode2random (development version)

- Fixed formatting issues (as requested by CRAN and identified on `m1mac`)

# rxode2random 2.0.12

- Added function `dfWishart` which gives (by simulation) an
Expand Down
2 changes: 1 addition & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Submission

- This fixes the arguments in init.c for the LTO issue identified in CRAN (thank you)
- This fixes the formatting issues identified by CRAN for `m1mac`
44 changes: 22 additions & 22 deletions src/cvPost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ NumericMatrix cvPost0(double nu, NumericMatrix omega, bool omegaIsChol = false,
//' Scaled Inverse Chi Squared distribution
//'
//' @param n Number of random samples
//'
//'
//' @param nu degrees of freedom of inverse chi square
//'
//' @param scale Scale of inverse chi squared distribution
//'
//' @param scale Scale of inverse chi squared distribution
//' (default is 1).
//'
//'
//' @return a vector of inverse chi squared deviates.
//'
//'
//' @examples
//' rinvchisq(3, 4, 1) ## Scale = 1, degrees of freedom = 4
//' rinvchisq(2, 4, 2) ## Scale = 2, degrees of freedom = 4
Expand Down Expand Up @@ -271,16 +271,16 @@ void rgbeta(int d, double shape, double* out){
//' One correlation sample from the LKJ distribution
//'
//' @param d The dimension of the correlation matrix
//'
//'
//' @param eta The scaling parameter of the LKJ distribution.
//' Must be > 1. Also related to the degrees of freedom nu.
//' eta = (nu-1)/2.
//'
//'
//' @param cholesky boolean; If `TRUE` return the cholesky
//' decomposition.
//'
//' @return A correlation sample from the LKJ distribution
//'
//'
//' @author Matthew Fidler (translated to RcppArmadillo) and Emma Schwager
//' @export
//' @keywords internal
Expand Down Expand Up @@ -350,13 +350,13 @@ arma::mat rLKJcvLsd1(arma::vec logSd, arma::vec logSdSD, double eta = 1.0){
//' random covariate to a correlation.
//'
//' @inheritParams rLKJ1
//'
//'
//' @param nu Degrees of freedom of the Wishart distribution
//'
//'
//' @inheritParams cvPost
//'
//' @return One correlation sample from the inverse wishart
//'
//'
//' @author Matthew Fidler
//' @keywords internal
//' @export
Expand Down Expand Up @@ -608,7 +608,7 @@ SEXP cvPost_(SEXP nuS, SEXP omegaS, SEXP nS, SEXP omegaIsCholS,
arma::mat om0 = as<arma::mat>(omega);
om0 = om0.t();
List ret(om0.n_cols);
if (n != 1) Rf_warningcall(R_NilValue, _("'n' is determined by the 'omega' argument which contains the simulated standard deviations"));
if (n != 1) Rf_warningcall(R_NilValue, "%s", _("'n' is determined by the 'omega' argument which contains the simulated standard deviations"));
for (unsigned int i = 0; i < om0.n_cols; i++){
arma::vec sd = om0.col(i);
if (nu < 3){
Expand Down Expand Up @@ -721,7 +721,7 @@ SEXP expandTheta_(SEXP thetaS, SEXP thetaMatS,
}
// Theta and thetaMat are correct, assign ".theta"
rxModelsAssign(".theta", thetaMatS);

qassertS(nCoresRVS, "X1[1,)", "nCoresRV");
NumericMatrix retNM = rxRmvnSEXP(nStudS, as<SEXP>(theta), as<SEXP>(thetaMat),
thetaLowerS, thetaUpperS, nCoresRVS,
Expand Down Expand Up @@ -827,7 +827,7 @@ SEXP expandPars_(SEXP objectS, SEXP paramsS, SEXP eventsS, SEXP controlS) {
}
SEXP omegaPre = PROTECT(wrap(omega)); pro++;
Rf_setAttrib(omegaPre, R_DimNamesSymbol, as<SEXP>(dimnames));

// Convert to a lotri matrix
omegaLotri = PROTECT(asLotriMat(omegaPre,
as<SEXP>(List::create(_["lower"] = control[Rxc_omegaLower],
Expand All @@ -848,7 +848,7 @@ SEXP expandPars_(SEXP objectS, SEXP paramsS, SEXP eventsS, SEXP controlS) {
SEXP lotriAbove = R_NilValue,
lotriBelow = R_NilValue;
int nid = 1;
List ni;
List ni;

Check warning on line 851 in src/cvPost.cpp

View check run for this annotation

Codecov / codecov/patch

src/cvPost.cpp#L851

Added line #L851 was not covered by tests
CharacterVector allNames;
std::string methodStr;
int methodInt = 1;
Expand Down Expand Up @@ -909,7 +909,7 @@ SEXP expandPars_(SEXP objectS, SEXP paramsS, SEXP eventsS, SEXP controlS) {
events = PROTECT(etTrans(as<List>(eventsS), nestObj,
(INTEGER(mv[RxMv_flags])[RxMvFlag_hasCmt] == 1),
false, false, true, R_NilValue,
control[Rxc_keepF],
control[Rxc_keepF],
control[Rxc_addlKeepsCov],
control[Rxc_addlDropSs],
control[Rxc_ssAtDoseTime])); pro++;
Expand Down Expand Up @@ -954,10 +954,10 @@ SEXP expandPars_(SEXP objectS, SEXP paramsS, SEXP eventsS, SEXP controlS) {
List bounds = PROTECT(lotriGetBounds(lotriAbove, R_NilValue, R_NilValue)); pro++;
NumericVector upper = bounds[0];
NumericVector lower = bounds[1];
// With
// With
NumericMatrix aboveMat = rxRmvnSEXP(IntegerVector::create(1),
R_NilValue, thetaList,
upper, lower, // lower upper
upper, lower, // lower upper
control[Rxc_nCoresRV],
LogicalVector::create(false), // isChol
LogicalVector::create(true), // keepNames
Expand Down Expand Up @@ -1010,7 +1010,7 @@ SEXP expandPars_(SEXP objectS, SEXP paramsS, SEXP eventsS, SEXP controlS) {
NumericVector lower = bounds[1];
NumericMatrix belowMat = rxRmvnSEXP(IntegerVector::create(nSub),
R_NilValue, omegaList,
upper, lower, // lower upper
upper, lower, // lower upper
control[Rxc_nCoresRV],
LogicalVector::create(false), // isChol
LogicalVector::create(true), // keepNames
Expand Down Expand Up @@ -1079,7 +1079,7 @@ SEXP expandPars_(SEXP objectS, SEXP paramsS, SEXP eventsS, SEXP controlS) {
events = PROTECT(etTrans(as<List>(eventsS), nestObj,
(INTEGER(mv[RxMv_flags])[RxMvFlag_hasCmt] == 1),
false, false, true, R_NilValue,
control[Rxc_keepF],
control[Rxc_keepF],
control[Rxc_addlKeepsCov],
control[Rxc_addlDropSs],
control[Rxc_ssAtDoseTime])); pro++;
Expand All @@ -1088,7 +1088,7 @@ SEXP expandPars_(SEXP objectS, SEXP paramsS, SEXP eventsS, SEXP controlS) {
events = PROTECT(etTrans(as<List>(events), nestObj,
(INTEGER(mv[RxMv_flags])[RxMvFlag_hasCmt] == 1),
false, false, true, R_NilValue,
control[Rxc_keepF],
control[Rxc_keepF],
control[Rxc_addlKeepsCov],
control[Rxc_addlDropSs],
control[Rxc_ssAtDoseTime])); pro++;
Expand All @@ -1105,7 +1105,7 @@ SEXP expandPars_(SEXP objectS, SEXP paramsS, SEXP eventsS, SEXP controlS) {
NumericVector upper = bounds[0];
NumericVector lower = bounds[1];
SEXP sigmaMat = rxRmvnSEXP(n2, R_NilValue, sigmaList,
upper, lower, // lower upper
upper, lower, // lower upper
control[Rxc_nCoresRV],
LogicalVector::create(false), // isChol
LogicalVector::create(true), // keepNames
Expand Down
8 changes: 4 additions & 4 deletions src/rxthreefry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern "C" {
typedef SEXP (*getUpperVec_t)(int type, rx_solve* rx);
typedef SEXP (*getArmaMat_t)(int type, int csim, rx_solve* rx);


getLowerVec_t getLowerVecSexp;
getUpperVec_t getUpperVecSexp;
getArmaMat_t getArmaMatSexp;
Expand All @@ -43,7 +43,7 @@ arma::vec getLowerVec(int type, rx_solve* rx) {
}
arma::vec getUpperVec(int type, rx_solve* rx) {
return as<arma::vec>(getUpperVecSexp(type, rx));

}
arma::mat getArmaMat(int type, int csim, rx_solve* rx) {
return as<arma::mat>(getArmaMatSexp(type, csim, rx));
Expand Down Expand Up @@ -703,7 +703,7 @@ arma::mat mvrandn(arma::vec lin, arma::vec uin, arma::mat Sig, int n,
arma::vec D=Lfull.diag();
arma::uvec perm=outC.perm;
if (any(D < 1e-10)){
Rf_warningcall(R_NilValue, _("truncated multivariate normal may fail as covariance matrix is singular"));
Rf_warningcall(R_NilValue, "%s", _("truncated multivariate normal may fail as covariance matrix is singular"));

Check warning on line 706 in src/rxthreefry.cpp

View check run for this annotation

Codecov / codecov/patch

src/rxthreefry.cpp#L706

Added line #L706 was not covered by tests
}
// rescale
arma::mat L=Lfull.each_col()/D;
Expand Down Expand Up @@ -740,7 +740,7 @@ arma::mat mvrandn(arma::vec lin, arma::vec uin, arma::mat Sig, int n,
}
iter++;
if (iter == 1e3){
Rf_warningcall(R_NilValue, _("acceptance probability smaller than 0.001"));
Rf_warningcall(R_NilValue, "%s", _("acceptance probability smaller than 0.001"));

Check warning on line 743 in src/rxthreefry.cpp

View check run for this annotation

Codecov / codecov/patch

src/rxthreefry.cpp#L743

Added line #L743 was not covered by tests
} else if (iter> 1e4){
if (accepted == 0) {
stop(_("could not sample from truncated normal"));
Expand Down
4 changes: 2 additions & 2 deletions src/seed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ uint32_t rxSeed = 0;
extern "C" SEXP _rxode2random_rxSetSeed(SEXP intIn) {
int type = TYPEOF(intIn);
if (Rf_length(intIn) != 1) {
Rf_errorcall(R_NilValue, _("'seed' must be an integer of length 1"));
Rf_errorcall(R_NilValue, "%s", _("'seed' must be an integer of length 1"));

Check warning on line 26 in src/seed.cpp

View check run for this annotation

Codecov / codecov/patch

src/seed.cpp#L26

Added line #L26 was not covered by tests
}
if (type == REALSXP) {
double in = REAL(intIn)[0];
Expand All @@ -44,7 +44,7 @@ extern "C" SEXP _rxode2random_rxSetSeed(SEXP intIn) {
useRxSeed = true;
}
} else {
Rf_errorcall(R_NilValue, _("'seed' must be an integer of length 1"));
Rf_errorcall(R_NilValue, "%s", _("'seed' must be an integer of length 1"));

Check warning on line 47 in src/seed.cpp

View check run for this annotation

Codecov / codecov/patch

src/seed.cpp#L47

Added line #L47 was not covered by tests
}
return R_NilValue;
}
Expand Down

0 comments on commit 99cb812

Please sign in to comment.