diff --git a/R/data.R b/R/data.R index 98da5b51db8bad95f86187dd0e66353c48d1e5dc..589c801a33bd56cfb39b86b6b06ddb406cc5dbe4 100644 --- a/R/data.R +++ b/R/data.R @@ -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 diff --git a/R/ridgeSIR.R b/R/ridgeSIR.R index a0b3acc76ff572312d85e55a199d5b9d790d9021..a05be30fedd0610e6acd3229b7fb59e5e51c7e38 100644 --- a/R/ridgeSIR.R +++ b/R/ridgeSIR.R @@ -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) } diff --git a/R/sfcb_methods.R b/R/sfcb_methods.R index 25a28b4d708b23e5600982562b4365fe0b244ba8..ae39684ba51d672a39ad167e511541675c23d5f3 100644 --- a/R/sfcb_methods.R +++ b/R/sfcb_methods.R @@ -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", diff --git a/R/sparseSIR.R b/R/sparseSIR.R index 7eb9bf7503af9c2b03618092f53e9b6324ce5e62..ed41152743d81ac9f5e9c82f32d1725e304e9f1a 100644 --- a/R/sparseSIR.R +++ b/R/sparseSIR.R @@ -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{ diff --git a/man/SFCB-class.Rd b/man/SFCB-class.Rd index 4a6902d848ab461c6fb791118b2a87a986c62948..2612081a19ead240f242da20f9667e06d394c233 100644 --- a/man/SFCB-class.Rd +++ b/man/SFCB-class.Rd @@ -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", diff --git a/man/SISIR.Rd b/man/SISIR.Rd index 42f32349ec5d5a397240589d2e073964e6071ad2..bd15b59386502580fd65179410da09dfa20053c9 100644 --- a/man/SISIR.Rd +++ b/man/SISIR.Rd @@ -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{ diff --git a/man/project.Rd b/man/project.Rd index bdf51090acbafed0541baf6e5285d5a62e30c22c..621087c9ae0c1be9b00938510697faab46b67cb3 100644 --- a/man/project.Rd +++ b/man/project.Rd @@ -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) diff --git a/man/ridgeSIR.Rd b/man/ridgeSIR.Rd index 248061b73f786eba99a0067a956c33d13c4ddee9..22759679e832868654373854fea817d553613e7b 100644 --- a/man/ridgeSIR.Rd +++ b/man/ridgeSIR.Rd @@ -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{ diff --git a/man/truffles.Rd b/man/truffles.Rd index 2763f3073ad56197deb5fc4e5cd3005fb30107a3..2fde4e8d1d868d9008d43c47d891c882c8e048fe 100644 --- a/man/truffles.Rd +++ b/man/truffles.Rd @@ -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 diff --git a/man/tune.ridgeSIR.Rd b/man/tune.ridgeSIR.Rd index 85ccd2cef9aa8e16c05409c5aa2be999e75623c9..dd83c9352646fb296f0dd9f7cd1196aa78c158d9 100644 --- a/man/tune.ridgeSIR.Rd +++ b/man/tune.ridgeSIR.Rd @@ -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{