Skip to content
Snippets Groups Projects
Commit 70600fa9 authored by Nathalie Vialaneix's avatar Nathalie Vialaneix
Browse files

removed dontrun from examples (issue #12)

parent b3d45da6
No related branches found
No related tags found
No related merge requests found
......@@ -38,9 +38,7 @@
#'
#' @examples
#' data(truffles)
#' \dontrun{
#' summary(truffles)
#' plot(1:15, rainfall[1, ], type = "l", xlab = "month", ylab = "rainfall (mm)")
#' }
NULL
\ No newline at end of file
......@@ -46,7 +46,7 @@
#' y <- log(abs(x %*% beta[ ,1])) + sqrt(abs(x %*% beta[ ,2]))
#' y <- y + rnorm(50, sd = 0.1)
#' res_ridge <- ridgeSIR(x, y, H = 10, d = 2, mu2 = 10^8)
#' \dontrun{print(res_ridge)}
#' res_ridge
#'
#' @return S3 object of class \code{ridgeRes}: a list consisting of
#' \describe{
......@@ -245,9 +245,9 @@ print.ridgeRes <- function(x, ...) {
#' listH <- c(5, 10)
#' list_d <- 1:4
#' set.seed(1129)
#' \dontrun{
#' res_tune <- tune.ridgeSIR(x, y, listH, list_mu2, list_d,
#' nfolds = 10, parallel = TRUE)}
#' \donttest{
#' res_tune <- tune.ridgeSIR(x, y, listH, list_mu2, list_d, nfolds = 10,
#' parallel = TRUE, ncores = 2)}
#'
#' @return a data frame with tested parameters and corresponding CV error and
#' estimation of R(d)
......@@ -285,7 +285,7 @@ tune.ridgeSIR <- function(x, y, listH, list_mu2, list_d, nfolds = 10,
mu2 <- list_mu2[ind_mu2]
res_SIR <- processSIR(pre, max_d, mu2)
global_projector[[ind_mu2]] <- sapply(list_d, function(d) {
projectorEDR(res_SIR$EDR[ ,1:d,drop = FALSE], pre$ccov_x, mu2)
projectorEDR(res_SIR$EDR[ , 1:d, drop = FALSE], pre$ccov_x, mu2)
}, simplify = FALSE)
}
......
......@@ -66,11 +66,9 @@
#' summary.method = "pls", selection.method = "relief")
#' summary(out1)
#'
#' \dontrun{
#' plot(out1)
#' plot(out1, plot.type = "selection")
#' plot(out1, plot.type = "importance")
#' }
#'
#' out2 <- sfcb(rainfall, truffles, group.method = "adjclust",
#' summary.method = "basics", selection.method = "none",
......
......@@ -90,6 +90,7 @@ sparseSIR <- function(object, inter_len, adaptive = FALSE, sel_prop = 0.05,
parallel = FALSE, ncores = NULL) {
if (parallel) {
if (is.null(ncores)) ncores <- min(detectCores() - 1)
print(ncores)
registerDoParallel(cores = ncores)
}
oldwarn <- getOption("warn")
......@@ -259,7 +260,7 @@ print.sparseRes <- function(x, ...) {
#' beta[((tsteps < 0.6) | (tsteps > 0.75)), 2] <- 0
#' y <- log(abs(x %*% beta[ ,1]) + 1) + sqrt(abs(x %*% beta[ ,2]))
#' y <- y + rnorm(nsim, sd = 0.1)
#' \dontrun{
#' \donttest{
#' res_ridge <- ridgeSIR(x, y, H = 10, d = 2)
#' res_sparse <- sparseSIR(res_ridge, rep(1, ncol(x)))
#' proj_data <- project(res_sparse)
......@@ -334,7 +335,8 @@ project <- function(object) {
#' y <- log(abs(x %*% beta[ ,1]) + 1) + sqrt(abs(x %*% beta[ ,2]))
#' y <- y + rnorm(nsim, sd = 0.1)
#' res_ridge <- ridgeSIR(x, y, H = 10, d = 2, mu2 = 10^8)
#' \dontrun{res_fused <- SISIR(res_ridge, rep(1, ncol(x)))}
#' \donttest{res_fused <- SISIR(res_ridge, rep(1, ncol(x)), ncores = 2)
#' res_fused}
#'
#' @return S3 object of class \code{SISIR}: a list consisting of
#' \describe{
......
......@@ -90,11 +90,9 @@ out1 <- sfcb(rainfall, truffles, group.method = "adjclust",
summary.method = "pls", selection.method = "relief")
summary(out1)
\dontrun{
plot(out1)
plot(out1, plot.type = "selection")
plot(out1, plot.type = "importance")
}
out2 <- sfcb(rainfall, truffles, group.method = "adjclust",
summary.method = "basics", selection.method = "none",
......
......@@ -74,7 +74,8 @@ beta[((tsteps < 0.6) | (tsteps > 0.75)), 2] <- 0
y <- log(abs(x \%*\% beta[ ,1]) + 1) + sqrt(abs(x \%*\% beta[ ,2]))
y <- y + rnorm(nsim, sd = 0.1)
res_ridge <- ridgeSIR(x, y, H = 10, d = 2, mu2 = 10^8)
\dontrun{res_fused <- SISIR(res_ridge, rep(1, ncol(x)))}
\donttest{res_fused <- SISIR(res_ridge, rep(1, ncol(x)), ncores = 2)
res_fused}
}
\references{
......
......@@ -36,7 +36,7 @@ beta[((tsteps < 0.2) | (tsteps > 0.5)), 1] <- 0
beta[((tsteps < 0.6) | (tsteps > 0.75)), 2] <- 0
y <- log(abs(x \%*\% beta[ ,1]) + 1) + sqrt(abs(x \%*\% beta[ ,2]))
y <- y + rnorm(nsim, sd = 0.1)
\dontrun{
\donttest{
res_ridge <- ridgeSIR(x, y, H = 10, d = 2)
res_sparse <- sparseSIR(res_ridge, rep(1, ncol(x)))
proj_data <- project(res_sparse)
......
......@@ -56,7 +56,7 @@ beta <- cbind(sin(tsteps*3*pi/2), sin(tsteps*5*pi/2))
y <- log(abs(x \%*\% beta[ ,1])) + sqrt(abs(x \%*\% beta[ ,2]))
y <- y + rnorm(50, sd = 0.1)
res_ridge <- ridgeSIR(x, y, H = 10, d = 2, mu2 = 10^8)
\dontrun{print(res_ridge)}
res_ridge
}
\references{
......
......@@ -32,11 +32,9 @@ station) and truffle production data are courtesy of the truffle patch.
}
\examples{
data(truffles)
\dontrun{
summary(truffles)
plot(1:15, rainfall[1, ], type = "l", xlab = "month", ylab = "rainfall (mm)")
}
}
\references{
Baragatti M., Grollemund P.M., Montpied P., Dupouey J.L., Gravier J., Murat
C., Le Tacon F. (2019) Influence of annual climatic variations, climate
......
......@@ -55,9 +55,9 @@ list_mu2 <- 10^(0:10)
listH <- c(5, 10)
list_d <- 1:4
set.seed(1129)
\dontrun{
res_tune <- tune.ridgeSIR(x, y, listH, list_mu2, list_d,
nfolds = 10, parallel = TRUE)}
\donttest{
res_tune <- tune.ridgeSIR(x, y, listH, list_mu2, list_d, nfolds = 10,
parallel = TRUE, ncores = 2)}
}
\references{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment