From: Benjamin Auder Date: Thu, 19 Apr 2018 08:21:16 +0000 (+0200) Subject: Adjustments to pass R CMD check --as-cran X-Git-Url: https://git.auder.net/DESCRIPTION?a=commitdiff_plain;h=cf673dee64ab0ce02ccaaba0fb63a9a4589ee8aa;p=morpheus.git Adjustments to pass R CMD check --as-cran --- diff --git a/pkg/DESCRIPTION b/pkg/DESCRIPTION index eb5e6f6..e1050a3 100644 --- a/pkg/DESCRIPTION +++ b/pkg/DESCRIPTION @@ -16,6 +16,7 @@ Imports: methods, pracma Suggests: + devtools, flexmix, parallel, testthat, diff --git a/pkg/R/A_NAMESPACE.R b/pkg/R/A_NAMESPACE.R index ea2711e..0a45138 100644 --- a/pkg/R/A_NAMESPACE.R +++ b/pkg/R/A_NAMESPACE.R @@ -3,8 +3,8 @@ #' @useDynLib morpheus #' #' @importFrom jointDiag ajd -#' @importFrom stats rbinom rmultinom rnorm pnorm runif integrate -#' @importFrom graphics boxplot barplot hist par +#' @importFrom stats rbinom rmultinom rnorm pnorm runif integrate sd +#' @importFrom graphics boxplot barplot hist par matplot #' @importFrom methods new #' @importFrom pracma integral #' diff --git a/pkg/R/multiRun.R b/pkg/R/multiRun.R index 0a2a833..1cebaab 100644 --- a/pkg/R/multiRun.R +++ b/pkg/R/multiRun.R @@ -11,6 +11,7 @@ #' @param prepareArgs Prepare arguments for the functions inside estimParams #' @param N Number of runs #' @param ncores Number of cores for parallel runs (<=1: sequential) +#' @param agg Aggregation method (default: lapply) #' @param verbose TRUE to indicate runs + methods numbers #' #' @return A list of nf aggregates of N results (matrices). diff --git a/pkg/R/optimParams.R b/pkg/R/optimParams.R index 9185efb..1ef1494 100644 --- a/pkg/R/optimParams.R +++ b/pkg/R/optimParams.R @@ -56,11 +56,6 @@ optimParams = function(K, link=c("logit","probit"), optargs=list()) M <- computeMoments(optargs$X,optargs$Y) } - # TODO: field?! - exactComp <<- optargs$exact - if (is.null(exactComp)) - exactComp <<- FALSE - # Build and return optimization algorithm object methods::new("OptimParams", "li"=link, "M1"=as.double(M[[1]]), "M2"=as.double(M[[2]]), "M3"=as.double(M[[3]]), "K"=as.integer(K)) @@ -249,6 +244,8 @@ setRefClass( # link="probit"; order=2; λ=c(531.8099,586.8893,523.5816); b=c(-118.512674,-3.488020,2.109969) # Switch to pracma package for that (but it seems slow...) + exactComp <- FALSE #TODO: global, or argument... + if (exactComp && link == "probit") { # Use exact computations diff --git a/pkg/R/plot.R b/pkg/R/plot.R index 0097607..265f1cd 100644 --- a/pkg/R/plot.R +++ b/pkg/R/plot.R @@ -115,6 +115,9 @@ plotCoefs <- function(mr, params) #' Draw 3D map of objective function values #' #' @param N Number of starting points +#' @param n Number of points in sample +#' @param p Vector of proportions +#' @param b Vector of biases #' @param β Regression matrix (target) #' @param link Link function (logit or probit) #' diff --git a/pkg/tests/testthat.R b/pkg/tests/testthat.R index 539a565..3b28538 100644 --- a/pkg/tests/testthat.R +++ b/pkg/tests/testthat.R @@ -1,5 +1,10 @@ library(testthat) -#library(morpheus) -load_all() + +# Locally: +#library(devtools) +#load_all("../") + +# With R CMD check: +library(morpheus) test_check("morpheus") diff --git a/to-cran.sh b/to-cran.sh index b7e0ccd..16d4407 100755 --- a/to-cran.sh +++ b/to-cran.sh @@ -9,6 +9,7 @@ for file in `find -name *.R`; do if [ -f $file ]; then sed -i 's/μ/mu/g' $file sed -i 's/β/beta/g' $file + sed -i 's/ρ/rho/g' $file sed -i 's/λ/lambda/g' $file sed -i 's/Σ/Sigma/g' $file fi