From 332e45f69b5b99ec765070ec6c2ce6e5820a1a9e Mon Sep 17 00:00:00 2001 From: Max-Bladen Date: Tue, 29 Mar 2022 11:00:25 +1100 Subject: [PATCH] Enhancement for Issue #34 --- R/block.pls.R | 16 ++++++++++++++-- R/block.plsda.R | 13 ++++++++++++- R/block.spls.R | 14 +++++++++++++- R/block.splsda.R | 14 +++++++++++++- R/mint.pca.R | 14 +++++++++++++- R/mint.pls.R | 14 +++++++++++++- R/mint.plsda.R | 14 +++++++++++++- R/mint.spls.R | 16 ++++++++++++++-- R/mint.splsda.R | 14 +++++++++++++- R/pca.R | 17 +++++++++++++++-- R/pls.R | 14 +++++++++++++- R/rcc.R | 14 +++++++++++++- R/spca.R | 14 +++++++++++++- R/spls.R | 13 ++++++++++++- man-roxygen/arg/verbose.call.R | 3 +++ man/block.pls.Rd | 12 ++++++++++-- man/block.plsda.Rd | 12 ++++++++++-- man/block.spls.Rd | 12 ++++++++++-- man/block.splsda.Rd | 15 ++++++++++++--- man/mint.block.pls.Rd | 2 +- man/mint.block.plsda.Rd | 2 +- man/mint.block.spls.Rd | 2 +- man/mint.block.splsda.Rd | 2 +- man/mint.pca.Rd | 17 ++++++++++++++++- man/mint.pls.Rd | 10 +++++++++- man/mint.plsda.Rd | 10 +++++++++- man/mint.spls.Rd | 12 ++++++++++-- man/mint.splsda.Rd | 10 +++++++++- man/pca.Rd | 11 +++++++++-- man/pls.Rd | 10 +++++++++- man/rcc.Rd | 10 +++++++++- man/spca.Rd | 10 +++++++++- man/spls.Rd | 10 +++++++++- man/tune.block.splsda.Rd | 2 +- 34 files changed, 332 insertions(+), 43 deletions(-) create mode 100644 man-roxygen/arg/verbose.call.R diff --git a/R/block.pls.R b/R/block.pls.R index d276a77a..c117884a 100644 --- a/R/block.pls.R +++ b/R/block.pls.R @@ -54,7 +54,8 @@ #' \code{'horst'}, see reference. #' @param init Mode of initialization use in the algorithm, either by Singular #' Value Decomposition of the product of each block of X with Y ('svd') or each -#' block independently ('svd.single'). Default = \code{svd.single}. +#' block independently ('svd.single'). Default = \code{svd.single} +#' @template arg/verbose.call #' @return \code{block.pls} returns an object of class \code{'block.pls'}, a #' list that contains the following components: #' @@ -69,6 +70,9 @@ #' iterations of the algorithm for each component} #' \item{prop_expl_var}{Percentage of explained variance for each #' component and each block} +#' \item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +#' If \code{verbose.call = TRUE} then all the inputted values are accessable via +#' this component} #' @author Florian Rohart, Benoit Gautier, Kim-Anh Lê Cao, Al J Abadi #' @seealso \code{\link{plotIndiv}}, \code{\link{plotArrow}}, #' \code{\link{plotLoadings}}, \code{\link{plotVar}}, \code{\link{predict}}, @@ -98,7 +102,8 @@ block.pls <- function(X, tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE) + all.outputs = TRUE, + verbose.call = FALSE) { # call to 'internal_wrapper.mint.block' @@ -132,6 +137,13 @@ block.pls <- function(X, weights = weights, prop_expl_var = result$prop_expl_var) + if (verbose.call) { + c <- out$call + out$call <- mget(names(formals())) + out$call <- append(c, out$call) + names(out$call)[1] <- "simple.call" + } + # give a class class(out) = c("block.pls","sgcca") diff --git a/R/block.plsda.R b/R/block.plsda.R index 384bbdbc..00e66312 100644 --- a/R/block.plsda.R +++ b/R/block.plsda.R @@ -51,6 +51,9 @@ #' iterations of the algorithm for each component} #' \item{prop_expl_var}{Percentage of explained variance for each #' component and each block} +#' \item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +#' If \code{verbose.call = TRUE} then all the inputted values are accessable via +#' this component} #' @author Florian Rohart, Benoit Gautier, Kim-Anh Lê Cao, Al J Abadi #' @seealso \code{\link{plotIndiv}}, \code{\link{plotArrow}}, #' \code{\link{plotLoadings}}, \code{\link{plotVar}}, \code{\link{predict}}, @@ -98,7 +101,8 @@ block.plsda <- function(X, tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE) + all.outputs = TRUE, + verbose.call = FALSE) { # check inpuy 'Y' and transformation in a dummy matrix @@ -186,6 +190,13 @@ block.plsda <- function(X, prop_expl_var = result$prop_expl_var )#[-result$indY]) + if (verbose.call) { + c <- out$call + out$call <- mget(names(formals())) + out$call <- append(c, out$call) + names(out$call)[1] <- "simple.call" + } + # give a class class(out) = c("block.plsda", "block.pls", "sgccda", "sgcca", "DA") return(invisible(out)) diff --git a/R/block.spls.R b/R/block.spls.R index dc073b30..fcc305e7 100644 --- a/R/block.spls.R +++ b/R/block.spls.R @@ -50,6 +50,7 @@ #' default all variables are kept in the model. #' @param keepY Only if Y is provided (and not \code{indY}). Each entry is the number of variables to #' select in each of the blocks of Y for each component. +#' @template arg/verbose.call #' @return \code{block.spls} returns an object of class \code{"block.spls"}, a #' list that contains the following components: #' @@ -66,6 +67,9 @@ #' of the algorithm for each component} \item{prop_expl_var}{Percentage of #' explained variance for each component and each block after setting possible #' missing values in the centered data to zero} +#' \item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +#' If \code{verbose.call = TRUE} then all the inputted values are accessable via +#' this component} #' @author Florian Rohart, Benoit Gautier, Kim-Anh Lê Cao, Al J Abadi #' @seealso \code{\link{plotIndiv}}, \code{\link{plotArrow}}, #' \code{\link{plotLoadings}}, \code{\link{plotVar}}, \code{\link{predict}}, @@ -101,7 +105,8 @@ block.spls = function(X, tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE) + all.outputs = TRUE, + verbose.call = FALSE) { # call to 'internal_wrapper.mint.block' @@ -152,6 +157,13 @@ block.spls = function(X, prop_expl_var = result$prop_expl_var ) + if (verbose.call) { + c <- out$call + out$call <- mget(names(formals())) + out$call <- append(c, out$call) + names(out$call)[1] <- "simple.call" + } + # give a class class(out) = c("block.spls", "sgcca") return(invisible(out)) diff --git a/R/block.splsda.R b/R/block.splsda.R index 6a12c519..30a62526 100644 --- a/R/block.splsda.R +++ b/R/block.splsda.R @@ -36,6 +36,7 @@ #' #' @inheritParams block.plsda #' @inheritParams block.spls +#' @template arg/verbose.call #' @return \code{block.splsda} returns an object of class \code{"block.splsda", #' "block.spls"}, a list that contains the following components: #' @@ -52,6 +53,9 @@ #' between the variate of each block and the variate of the outcome. Used to #' weight predictions.} \item{prop_expl_var}{Percentage of explained #' variance for each component and each block} +#' \item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +#' If \code{verbose.call = TRUE} then all the inputted values are accessable via +#' this component} #' @author Florian Rohart, Benoit Gautier, Kim-Anh Lê Cao, Al J Abadi #' @seealso \code{\link{plotIndiv}}, \code{\link{plotArrow}}, #' \code{\link{plotLoadings}}, \code{\link{plotVar}}, \code{\link{predict}}, @@ -97,7 +101,8 @@ block.splsda <- function(X, tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE) + all.outputs = TRUE, + verbose.call = FALSE) { # check inpuy 'Y' and transformation in a dummy matrix if (!missing(Y)) @@ -190,6 +195,13 @@ block.splsda <- function(X, prop_expl_var = result$prop_expl_var )#[-result$indY]) + if (verbose.call) { + c <- out$call + out$call <- mget(names(formals())) + out$call <- append(c, out$call) + names(out$call)[1] <- "simple.call" + } + # give a class class(out) = c("block.splsda", "block.spls", "sgccda", "sgcca", "DA") return(invisible(out)) diff --git a/R/mint.pca.R b/R/mint.pca.R index 5fd37f47..9184a36e 100644 --- a/R/mint.pca.R +++ b/R/mint.pca.R @@ -34,6 +34,7 @@ #' means and unit variances. Default = \code{TRUE}. #' @param tol Convergence stopping value. #' @param max.iter integer, the maximum number of iterations. +#' @template arg/verbose.call #' @return \code{mint.pca} returns an object of class \code{"mint.pca", "pca"}, #' a list that contains the following components: #' @@ -51,6 +52,9 @@ #' spirit} \item{prop_expl_var}{Proportion of the explained variance from the multivariate #' model after setting possible missing values to zero in the data.} \item{names}{list containing the names to be used #' for individuals and variables.} +#' \item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +#' If \code{verbose.call = TRUE} then all the inputted values are accessable via +#' this component} #' @author Florian Rohart, Kim-Anh Lê Cao, Al J Abadi #' @seealso \code{\link{spls}}, \code{\link{summary}}, \code{\link{plotIndiv}}, #' \code{\link{plotVar}}, \code{\link{predict}}, \code{\link{perf}}, @@ -79,7 +83,8 @@ mint.pca <- function(X, study, scale = TRUE, tol = 1e-06, - max.iter = 100) + max.iter = 100, + verbose.call = FALSE) { #-- checking general input parameters --------------------------------------# @@ -177,6 +182,13 @@ mint.pca <- function(X, # choose the desired output from 'result' out$study <- study + if (verbose.call) { + c <- out$call + out$call <- mget(names(formals())) + out$call <- append(c, out$call) + names(out$call)[1] <- "simple.call" + } + class(out) <- c("mint.pca","pca") return(invisible(out)) diff --git a/R/mint.pls.R b/R/mint.pls.R index 7257e0a5..39b9789d 100644 --- a/R/mint.pls.R +++ b/R/mint.pls.R @@ -40,6 +40,7 @@ #' classification and factor response) #' @param study Factor, indicating the membership of each sample to each of the #' studies being combined +#' @template arg/verbose.call #' @return \code{mint.pls} returns an object of class \code{"mint.pls", "pls"}, #' a list that contains the following components: #' @@ -59,6 +60,9 @@ #' explained variance for each component and each study (note that contrary to #' PCA, this amount may not decrease as the aim of the method is not to #' maximise the variance, but the covariance between data sets).} +#' \item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +#' If \code{verbose.call = TRUE} then all the inputted values are accessable via +#' this component} #' @author Florian Rohart, Kim-Anh Lê Cao, Al J Abadi #' @seealso \code{\link{spls}}, \code{\link{summary}}, \code{\link{plotIndiv}}, #' \code{\link{plotVar}}, \code{\link{predict}}, \code{\link{perf}}, @@ -101,7 +105,8 @@ mint.pls <- function(X, tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE) + all.outputs = TRUE, + verbose.call = FALSE) { # call to 'internal_wrapper.mint' @@ -139,6 +144,13 @@ mint.pls <- function(X, prop_expl_var = result$prop_expl_var ) + if (verbose.call) { + c <- out$call + out$call <- mget(names(formals())) + out$call <- append(c, out$call) + names(out$call)[1] <- "simple.call" + } + class(out) = c("mint.pls","mixo_pls") return(invisible(out)) diff --git a/R/mint.plsda.R b/R/mint.plsda.R index 32c9e2ae..022be20e 100644 --- a/R/mint.plsda.R +++ b/R/mint.plsda.R @@ -34,6 +34,7 @@ #' @inheritParams mint.pls #' @param Y A factor or a class vector indicating the discrete outcome of each #' sample. +#' @template arg/verbose.call #' @return \code{mint.plsda} returns an object of class \code{"mint.plsda", #' "plsda"}, a list that contains the following components: #' @@ -55,6 +56,9 @@ #' (note that contrary to PCA, this amount may not decrease as the aim of the #' method is not to maximise the variance, but the covariance between X and the #' dummy matrix Y).} +#' \item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +#' If \code{verbose.call = TRUE} then all the inputted values are accessable via +#' this component} #' @author Florian Rohart, Kim-Anh Lê Cao, Al J Abadi #' @seealso \code{\link{spls}}, \code{\link{summary}}, \code{\link{plotIndiv}}, #' \code{\link{plotVar}}, \code{\link{predict}}, \code{\link{perf}}, @@ -100,7 +104,8 @@ mint.plsda <- function(X, tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE) + all.outputs = TRUE, + verbose.call = FALSE) { #-- validation des arguments --# # most of the checks are done in 'internal_wrapper.mint' @@ -169,6 +174,13 @@ mint.plsda <- function(X, prop_expl_var = result$prop_expl_var ) + if (verbose.call) { + c <- out$call + out$call <- mget(names(formals())) + out$call <- append(c, out$call) + names(out$call)[1] <- "simple.call" + } + class(out) <- c("mint.plsda", "mixo_plsda", "mixo_pls", "DA") return(invisible(out)) diff --git a/R/mint.spls.R b/R/mint.spls.R index e1dff8ab..eef07cf6 100644 --- a/R/mint.spls.R +++ b/R/mint.spls.R @@ -45,6 +45,7 @@ #' \code{X} on each component. By default all variables are kept in the model. #' @param keepY numeric vector indicating the number of variables to select in #' \code{Y} on each component. By default all variables are kept in the model. +#' @template arg/verbose.call #' @return \code{mint.spls} returns an object of class #' \code{"mint.spls","spls"}, a list that contains the following components: #' @@ -63,7 +64,7 @@ #' partial variates - partial loadings.} \item{names}{list containing the names #' to be used for individuals and variables.} \item{nzv}{list containing the #' zero- or near-zero predictors information.} \item{iter}{Number of iterations -#' of the algorithm for each component} #' \item{prop_expl_var}{The amount +#' of the algorithm for each component} \item{prop_expl_var}{The amount #' of the variance explained by each variate / component divided by the total #' variance in the \code{data} for each study (after removing the possible #' missing values) using the definition of 'redundancy'. Note that contrary to @@ -71,6 +72,9 @@ #' aim of the method is not to maximise the variance, but the covariance between #' data sets (including the dummy matrix representation of the outcome variable #' in case of the supervised approaches).} +#' \item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +#' If \code{verbose.call = TRUE} then all the inputted values are accessable via +#' this component} #' @author Florian Rohart, Kim-Anh Lê Cao, Al J Abadi #' @seealso \code{\link{spls}}, \code{\link{summary}}, \code{\link{plotIndiv}}, #' \code{\link{plotVar}}, \code{\link{predict}}, \code{\link{perf}}, @@ -115,7 +119,8 @@ mint.spls <- function(X, tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE) + all.outputs = TRUE, + verbose.call = FALSE) { # call to 'internal_wrapper.mint' @@ -157,6 +162,13 @@ mint.spls <- function(X, prop_expl_var = result$prop_expl_var ) + if (verbose.call) { + c <- out$call + out$call <- mget(names(formals())) + out$call <- append(c, out$call) + names(out$call)[1] <- "simple.call" + } + class(out) <- c("mint.spls","mixo_spls") return(invisible(out)) diff --git a/R/mint.splsda.R b/R/mint.splsda.R index 43e35ae2..9dec2c3f 100644 --- a/R/mint.splsda.R +++ b/R/mint.splsda.R @@ -36,6 +36,7 @@ #' #' @inheritParams mint.plsda #' @inheritParams mint.spls +#' @template arg/verbose.call #' @return \code{mint.splsda} returns an object of class \code{"mint.splsda", #' "splsda"}, a list that contains the following components: #' @@ -58,6 +59,9 @@ #' PCA, this amount may not decrease as the aim of the method is not to #' maximise the variance, but the covariance between X and the dummy matrix #' Y).} +#' \item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +#' If \code{verbose.call = TRUE} then all the inputted values are accessable via +#' this component} #' @author Florian Rohart, Kim-Anh Lê Cao, Al J Abadi #' @seealso \code{\link{spls}}, \code{\link{summary}}, \code{\link{plotIndiv}}, #' \code{\link{plotVar}}, \code{\link{predict}}, \code{\link{perf}}, @@ -106,7 +110,8 @@ mint.splsda <- function(X, tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE) + all.outputs = TRUE, + verbose.call = FALSE) { #-- validation des arguments --# @@ -177,6 +182,13 @@ mint.splsda <- function(X, prop_expl_var = result$prop_expl_var ) + if (verbose.call) { + c <- out$call + out$call <- mget(names(formals())) + out$call <- append(c, out$call) + names(out$call)[1] <- "simple.call" + } + class(out) <- c("mint.splsda", "mixo_splsda", "mixo_spls", "DA") return(invisible(out)) diff --git a/R/pca.R b/R/pca.R index 6866772b..f8135254 100644 --- a/R/pca.R +++ b/R/pca.R @@ -63,9 +63,12 @@ #' @param V Matrix used in the logratio transformation if provided. #' @param multilevel sample information for multilevel decomposition for #' repeated measurements. +#' @template arg/verbose.call #' @return \code{pca} returns a list with class \code{"pca"} and \code{"prcomp"} #' containing the following components: -#' \item{call}{The function call.} +#' \item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +#' If \code{verbose.call = TRUE} then all the inputted values are accessable via +#' this component} #' \item{X}{The input data matrix, possibly scaled and centered.} #' \item{ncomp}{The number of principal components used.} #' \item{center}{The centering used.} @@ -115,7 +118,8 @@ pca <- function(X, logratio = c('none','CLR','ILR'), ilr.offset = 0.001, V = NULL, - multilevel = NULL) + multilevel = NULL, + verbose.call = FALSE) { #-- checking general input parameters --------------------------------------# @@ -294,6 +298,15 @@ pca <- function(X, if(!is.null(multilevel)) # TODO include in docs returns result=c(result, list(Xw = Xw, design = multilevel)) + + + if (verbose.call) { + c <- result$call + result$call <- mget(names(formals())) + result$call <- append(c, result$call) + names(result$call)[1] <- "simple.call" + } + class(result) = c("pca") if(!is.null(multilevel)) class(result)=c("mlpca",class(result)) diff --git a/R/pls.R b/R/pls.R index 3a0079f6..dc0ff465 100644 --- a/R/pls.R +++ b/R/pls.R @@ -74,9 +74,13 @@ #' @templateVar multilevel.example in \code{?spls}. #' @template arg/multilevel #' @template arg/all.outputs +#' @template arg/verbose.call #' @return \code{pls} returns an object of class \code{"pls"}, a list that #' contains the following components: #' +#' \item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +#' If \code{verbose.call = TRUE} then all the inputted values are accessable via +#' this component} #' \item{X}{the centered and standardized original predictor matrix.} #' \item{Y}{the centered and standardized original response vector or matrix.} #' \item{ncomp}{the number of components included in the model.} @@ -146,7 +150,8 @@ pls <- function(X, logratio = "none", # one of "none", "CLR" multilevel = NULL, - all.outputs = TRUE) + all.outputs = TRUE, + verbose.call = FALSE) { # call to 'internal_wrapper.mint' result = internal_wrapper.mint( @@ -187,6 +192,13 @@ pls <- function(X, #defl.matrix = result$defl.matrix ) + if (verbose.call) { + c <- out$call + out$call <- mget(names(formals())) + out$call <- append(c, out$call) + names(out$call)[1] <- "simple.call" + } + class(out) = c("mixo_pls") # output if multilevel analysis if (!is.null(multilevel)) diff --git a/R/rcc.R b/R/rcc.R index e9284038..157f35e8 100644 --- a/R/rcc.R +++ b/R/rcc.R @@ -51,6 +51,7 @@ #' @param lambda1,lambda2 a non-negative real. The regularization parameter for #' the \emph{X} and \emph{Y} data. Defaults to \code{lambda1=lambda2=0}. Only #' used if \code{method="ridge"} +#' @template arg/verbose.call #' @return \code{rcc} returns a object of class \code{"rcc"}, a list that #' contains the following components: \item{X}{the original \eqn{X} data.} #' \item{Y}{the original \eqn{Y} data.} \item{cor}{a vector containing the @@ -63,6 +64,9 @@ #' individuals and variables.} #' \item{prop_expl_var}{Proportion of the explained variance of derived #' components, after setting possible missing values to zero.} +#' \item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +#' If \code{verbose.call = TRUE} then all the inputted values are accessable via +#' this component} #' @author Sébastien Déjean, Ignacio González, Francois Bartolo, Kim-Anh Lê Cao, #' Florian Rohart, Al J Abadi #' @seealso \code{\link{summary}}, \code{\link{tune.rcc}}, @@ -121,7 +125,8 @@ rcc <- ncomp = 2, method = c("ridge", "shrinkage"), lambda1 = 0, - lambda2 = 0 + lambda2 = 0, + verbose.call = FALSE ) { #-- checking general input parameters --------------------------------------# @@ -304,6 +309,13 @@ rcc <- explY=explained_variance(result$Y,result$variates$Y,ncomp) result$prop_expl_var=list(X=explX,Y=explY) + if (verbose.call) { + c <- result$call + result$call <- mget(names(formals())) + result$call <- append(c, result$call) + names(result$call)[1] <- "simple.call" + } + class(result) = "rcc" return(invisible(result)) diff --git a/R/spca.R b/R/spca.R index 933dd7e7..d8153dfa 100644 --- a/R/spca.R +++ b/R/spca.R @@ -46,9 +46,13 @@ #' @param logratio one of ('none','CLR'). Specifies the log ratio #' transformation to deal with compositional values that may arise from #' specific normalisation in sequencing data. Default to 'none' +#' @template arg/verbose.call #' @return \code{spca} returns a list with class \code{"spca"} containing the #' following components: #' \describe{ +#' \item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +#' If \code{verbose.call = TRUE} then all the inputted values are accessable via +#' this component} #' \item{ncomp}{the number of components to keep in the #' calculation.} #' \item{prop_expl_var}{the adjusted percentage of variance @@ -80,7 +84,8 @@ spca <- max.iter = 500, tol = 1e-06, logratio = c('none','CLR'), - multilevel = NULL) + multilevel = NULL, + verbose.call = FALSE) { #-- checking general input parameters --------------------------------------# @@ -361,6 +366,13 @@ spca <- ## warning if components are not orthogonal .eval_non.orthogonality(variates = result$variates$X, scale=scale) + if (verbose.call) { + c <- result$call + result$call <- mget(names(formals())) + result$call <- append(c, result$call) + names(result$call)[1] <- "simple.call" + } + class(result) = c("spca","pca", "prcomp") return(invisible(result)) } diff --git a/R/spls.R b/R/spls.R index d00beee4..b874a709 100644 --- a/R/spls.R +++ b/R/spls.R @@ -21,6 +21,9 @@ #' @param keepY numeric vector of length \code{ncomp}, the number of variables #' @return \code{spls} returns an object of class \code{"spls"}, a list that #' contains the following components: +#' \item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +#' If \code{verbose.call = TRUE} then all the inputted values are accessable via +#' this component} #' \item{X}{the centered and standardized original predictor matrix.} #' \item{Y}{the centered and standardized original response vector or matrix.} #' \item{ncomp}{the number of components included in the model.} @@ -101,7 +104,8 @@ spls <- function(X, logratio = "none", # one of "none", "CLR" multilevel = NULL, - all.outputs = TRUE) + all.outputs = TRUE, + verbose.call = FALSE) { @@ -147,6 +151,13 @@ spls <- function(X, mat.c = result$mat.c ) + if (verbose.call) { + c <- out$call + out$call <- mget(names(formals())) + out$call <- append(c, out$call) + names(out$call)[1] <- "simple.call" + } + class(out) = c("mixo_spls") # output if multilevel analysis diff --git a/man-roxygen/arg/verbose.call.R b/man-roxygen/arg/verbose.call.R new file mode 100644 index 00000000..7a66a2ac --- /dev/null +++ b/man-roxygen/arg/verbose.call.R @@ -0,0 +1,3 @@ +#' @param verbose.call Logical (Default=FALSE), if set to TRUE then the \code{$call} +#' component of the returned object will contain the variable values for all +#' parameters. Note that this may cause large memory usage. diff --git a/man/block.pls.Rd b/man/block.pls.Rd index d6595816..9fe641e0 100644 --- a/man/block.pls.Rd +++ b/man/block.pls.Rd @@ -17,7 +17,8 @@ block.pls( tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE + all.outputs = TRUE, + verbose.call = FALSE ) } \arguments{ @@ -56,7 +57,7 @@ means and unit variances (default: TRUE)} \item{init}{Mode of initialization use in the algorithm, either by Singular Value Decomposition of the product of each block of X with Y ('svd') or each -block independently ('svd.single'). Default = \code{svd.single}.} +block independently ('svd.single'). Default = \code{svd.single}} \item{tol}{Positive numeric used as convergence criteria/tolerance during the iterative process. Default to \code{1e-06}.} @@ -70,6 +71,10 @@ computations. Default value is FALSE.} \item{all.outputs}{Logical. Computation can be faster when some specific (and non-essential) outputs are not calculated. Default = \code{TRUE}.} + +\item{verbose.call}{Logical (Default=FALSE), if set to TRUE then the \code{$call} +component of the returned object will contain the variable values for all +parameters. Note that this may cause large memory usage.} } \value{ \code{block.pls} returns an object of class \code{'block.pls'}, a @@ -86,6 +91,9 @@ the zero- or near-zero predictors information.} \item{iter}{Number of iterations of the algorithm for each component} \item{prop_expl_var}{Percentage of explained variance for each component and each block} +\item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +If \code{verbose.call = TRUE} then all the inputted values are accessable via +this component} } \description{ Integration of multiple data sets measured on the same samples or diff --git a/man/block.plsda.Rd b/man/block.plsda.Rd index bcb384ed..8b09a206 100644 --- a/man/block.plsda.Rd +++ b/man/block.plsda.Rd @@ -17,7 +17,8 @@ block.plsda( tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE + all.outputs = TRUE, + verbose.call = FALSE ) } \arguments{ @@ -51,7 +52,7 @@ means and unit variances (default: TRUE)} \item{init}{Mode of initialization use in the algorithm, either by Singular Value Decomposition of the product of each block of X with Y ('svd') or each -block independently ('svd.single'). Default = \code{svd.single}.} +block independently ('svd.single'). Default = \code{svd.single}} \item{tol}{Positive numeric used as convergence criteria/tolerance during the iterative process. Default to \code{1e-06}.} @@ -65,6 +66,10 @@ computations. Default value is FALSE.} \item{all.outputs}{Logical. Computation can be faster when some specific (and non-essential) outputs are not calculated. Default = \code{TRUE}.} + +\item{verbose.call}{Logical (Default=FALSE), if set to TRUE then the \code{$call} +component of the returned object will contain the variable values for all +parameters. Note that this may cause large memory usage.} } \value{ \code{block.plsda} returns an object of class @@ -82,6 +87,9 @@ the zero- or near-zero predictors information.} \item{iter}{Number of iterations of the algorithm for each component} \item{prop_expl_var}{Percentage of explained variance for each component and each block} +\item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +If \code{verbose.call = TRUE} then all the inputted values are accessable via +this component} } \description{ Integration of multiple data sets measured on the same samples or diff --git a/man/block.spls.Rd b/man/block.spls.Rd index 09ca0e27..ecae21f6 100644 --- a/man/block.spls.Rd +++ b/man/block.spls.Rd @@ -20,7 +20,8 @@ block.spls( tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE + all.outputs = TRUE, + verbose.call = FALSE ) } \arguments{ @@ -66,7 +67,7 @@ means and unit variances (default: TRUE)} \item{init}{Mode of initialization use in the algorithm, either by Singular Value Decomposition of the product of each block of X with Y ('svd') or each -block independently ('svd.single'). Default = \code{svd.single}.} +block independently ('svd.single'). Default = \code{svd.single}} \item{tol}{Positive numeric used as convergence criteria/tolerance during the iterative process. Default to \code{1e-06}.} @@ -80,6 +81,10 @@ computations. Default value is FALSE.} \item{all.outputs}{Logical. Computation can be faster when some specific (and non-essential) outputs are not calculated. Default = \code{TRUE}.} + +\item{verbose.call}{Logical (Default=FALSE), if set to TRUE then the \code{$call} +component of the returned object will contain the variable values for all +parameters. Note that this may cause large memory usage.} } \value{ \code{block.spls} returns an object of class \code{"block.spls"}, a @@ -98,6 +103,9 @@ zero- or near-zero predictors information.} \item{iter}{Number of iterations of the algorithm for each component} \item{prop_expl_var}{Percentage of explained variance for each component and each block after setting possible missing values in the centered data to zero} +\item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +If \code{verbose.call = TRUE} then all the inputted values are accessable via +this component} } \description{ Integration of multiple data sets measured on the same samples or diff --git a/man/block.splsda.Rd b/man/block.splsda.Rd index 6879c7f9..9df7d21d 100644 --- a/man/block.splsda.Rd +++ b/man/block.splsda.Rd @@ -19,7 +19,8 @@ block.splsda( tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE + all.outputs = TRUE, + verbose.call = FALSE ) wrapper.sgccda( @@ -35,7 +36,8 @@ wrapper.sgccda( tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE + all.outputs = TRUE, + verbose.call = FALSE ) } \arguments{ @@ -73,7 +75,7 @@ means and unit variances (default: TRUE)} \item{init}{Mode of initialization use in the algorithm, either by Singular Value Decomposition of the product of each block of X with Y ('svd') or each -block independently ('svd.single'). Default = \code{svd.single}.} +block independently ('svd.single'). Default = \code{svd.single}} \item{tol}{Positive numeric used as convergence criteria/tolerance during the iterative process. Default to \code{1e-06}.} @@ -87,6 +89,10 @@ computations. Default value is FALSE.} \item{all.outputs}{Logical. Computation can be faster when some specific (and non-essential) outputs are not calculated. Default = \code{TRUE}.} + +\item{verbose.call}{Logical (Default=FALSE), if set to TRUE then the \code{$call} +component of the returned object will contain the variable values for all +parameters. Note that this may cause large memory usage.} } \value{ \code{block.splsda} returns an object of class \code{"block.splsda", @@ -105,6 +111,9 @@ iterations of the algorithm for each component} \item{weights}{Correlation between the variate of each block and the variate of the outcome. Used to weight predictions.} \item{prop_expl_var}{Percentage of explained variance for each component and each block} +\item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +If \code{verbose.call = TRUE} then all the inputted values are accessable via +this component} } \description{ Integration of multiple data sets measured on the same samples or diff --git a/man/mint.block.pls.Rd b/man/mint.block.pls.Rd index 5b87ea3c..9e391d86 100644 --- a/man/mint.block.pls.Rd +++ b/man/mint.block.pls.Rd @@ -60,7 +60,7 @@ means and unit variances (default: TRUE)} \item{init}{Mode of initialization use in the algorithm, either by Singular Value Decomposition of the product of each block of X with Y ('svd') or each -block independently ('svd.single'). Default = \code{svd.single}.} +block independently ('svd.single'). Default = \code{svd.single}} \item{tol}{Positive numeric used as convergence criteria/tolerance during the iterative process. Default to \code{1e-06}.} diff --git a/man/mint.block.plsda.Rd b/man/mint.block.plsda.Rd index 24600b13..f32e01f1 100644 --- a/man/mint.block.plsda.Rd +++ b/man/mint.block.plsda.Rd @@ -55,7 +55,7 @@ means and unit variances (default: TRUE)} \item{init}{Mode of initialization use in the algorithm, either by Singular Value Decomposition of the product of each block of X with Y ('svd') or each -block independently ('svd.single'). Default = \code{svd.single}.} +block independently ('svd.single'). Default = \code{svd.single}} \item{tol}{Positive numeric used as convergence criteria/tolerance during the iterative process. Default to \code{1e-06}.} diff --git a/man/mint.block.spls.Rd b/man/mint.block.spls.Rd index 4730a42a..e3fabdd0 100644 --- a/man/mint.block.spls.Rd +++ b/man/mint.block.spls.Rd @@ -69,7 +69,7 @@ means and unit variances (default: TRUE)} \item{init}{Mode of initialization use in the algorithm, either by Singular Value Decomposition of the product of each block of X with Y ('svd') or each -block independently ('svd.single'). Default = \code{svd.single}.} +block independently ('svd.single'). Default = \code{svd.single}} \item{tol}{Positive numeric used as convergence criteria/tolerance during the iterative process. Default to \code{1e-06}.} diff --git a/man/mint.block.splsda.Rd b/man/mint.block.splsda.Rd index 887788e0..84c76f12 100644 --- a/man/mint.block.splsda.Rd +++ b/man/mint.block.splsda.Rd @@ -60,7 +60,7 @@ means and unit variances (default: TRUE)} \item{init}{Mode of initialization use in the algorithm, either by Singular Value Decomposition of the product of each block of X with Y ('svd') or each -block independently ('svd.single'). Default = \code{svd.single}.} +block independently ('svd.single'). Default = \code{svd.single}} \item{tol}{Positive numeric used as convergence criteria/tolerance during the iterative process. Default to \code{1e-06}.} diff --git a/man/mint.pca.Rd b/man/mint.pca.Rd index 1c59caa9..64093368 100644 --- a/man/mint.pca.Rd +++ b/man/mint.pca.Rd @@ -4,7 +4,15 @@ \alias{mint.pca} \title{P-integration with Principal Component Analysis} \usage{ -mint.pca(X, ncomp = 2, study, scale = TRUE, tol = 1e-06, max.iter = 100) +mint.pca( + X, + ncomp = 2, + study, + scale = TRUE, + tol = 1e-06, + max.iter = 100, + verbose.call = FALSE +) } \arguments{ \item{X}{numeric matrix of predictors combining multiple independent studies @@ -22,6 +30,10 @@ means and unit variances. Default = \code{TRUE}.} \item{tol}{Convergence stopping value.} \item{max.iter}{integer, the maximum number of iterations.} + +\item{verbose.call}{Logical (Default=FALSE), if set to TRUE then the \code{$call} +component of the returned object will contain the variable values for all +parameters. Note that this may cause large memory usage.} } \value{ \code{mint.pca} returns an object of class \code{"mint.pca", "pca"}, @@ -41,6 +53,9 @@ principal components.} \item{variates}{same as 'x' to keep the mixOmics spirit} \item{prop_expl_var}{Proportion of the explained variance from the multivariate model after setting possible missing values to zero in the data.} \item{names}{list containing the names to be used for individuals and variables.} +\item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +If \code{verbose.call = TRUE} then all the inputted values are accessable via +this component} } \description{ Function to integrate and combine multiple independent studies measured on diff --git a/man/mint.pls.Rd b/man/mint.pls.Rd index 7ab002ea..87779df2 100644 --- a/man/mint.pls.Rd +++ b/man/mint.pls.Rd @@ -14,7 +14,8 @@ mint.pls( tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE + all.outputs = TRUE, + verbose.call = FALSE ) } \arguments{ @@ -49,6 +50,10 @@ computations. Default value is FALSE.} \item{all.outputs}{Logical. Computation can be faster when some specific (and non-essential) outputs are not calculated. Default = \code{TRUE}.} + +\item{verbose.call}{Logical (Default=FALSE), if set to TRUE then the \code{$call} +component of the returned object will contain the variable values for all +parameters. Note that this may cause large memory usage.} } \value{ \code{mint.pls} returns an object of class \code{"mint.pls", "pls"}, @@ -70,6 +75,9 @@ of the algorithm for each component} \item{prop_expl_var}{Percentage of explained variance for each component and each study (note that contrary to PCA, this amount may not decrease as the aim of the method is not to maximise the variance, but the covariance between data sets).} +\item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +If \code{verbose.call = TRUE} then all the inputted values are accessable via +this component} } \description{ Function to integrate and combine multiple independent studies measured on diff --git a/man/mint.plsda.Rd b/man/mint.plsda.Rd index ff7af135..fa737ba3 100644 --- a/man/mint.plsda.Rd +++ b/man/mint.plsda.Rd @@ -14,7 +14,8 @@ mint.plsda( tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE + all.outputs = TRUE, + verbose.call = FALSE ) } \arguments{ @@ -45,6 +46,10 @@ computations. Default value is FALSE.} \item{all.outputs}{Logical. Computation can be faster when some specific (and non-essential) outputs are not calculated. Default = \code{TRUE}.} + +\item{verbose.call}{Logical (Default=FALSE), if set to TRUE then the \code{$call} +component of the returned object will contain the variable values for all +parameters. Note that this may cause large memory usage.} } \value{ \code{mint.plsda} returns an object of class \code{"mint.plsda", @@ -68,6 +73,9 @@ each component and each study after setting possible missing values to zero (note that contrary to PCA, this amount may not decrease as the aim of the method is not to maximise the variance, but the covariance between X and the dummy matrix Y).} +\item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +If \code{verbose.call = TRUE} then all the inputted values are accessable via +this component} } \description{ Function to combine multiple independent studies measured on the same diff --git a/man/mint.spls.Rd b/man/mint.spls.Rd index 82acbb31..75ba6e53 100644 --- a/man/mint.spls.Rd +++ b/man/mint.spls.Rd @@ -16,7 +16,8 @@ mint.spls( tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE + all.outputs = TRUE, + verbose.call = FALSE ) } \arguments{ @@ -57,6 +58,10 @@ computations. Default value is FALSE.} \item{all.outputs}{Logical. Computation can be faster when some specific (and non-essential) outputs are not calculated. Default = \code{TRUE}.} + +\item{verbose.call}{Logical (Default=FALSE), if set to TRUE then the \code{$call} +component of the returned object will contain the variable values for all +parameters. Note that this may cause large memory usage.} } \value{ \code{mint.spls} returns an object of class @@ -77,7 +82,7 @@ variates of X relative to each study - partial variates.} partial variates - partial loadings.} \item{names}{list containing the names to be used for individuals and variables.} \item{nzv}{list containing the zero- or near-zero predictors information.} \item{iter}{Number of iterations -of the algorithm for each component} #' \item{prop_expl_var}{The amount +of the algorithm for each component} \item{prop_expl_var}{The amount of the variance explained by each variate / component divided by the total variance in the \code{data} for each study (after removing the possible missing values) using the definition of 'redundancy'. Note that contrary to @@ -85,6 +90,9 @@ missing values) using the definition of 'redundancy'. Note that contrary to aim of the method is not to maximise the variance, but the covariance between data sets (including the dummy matrix representation of the outcome variable in case of the supervised approaches).} +\item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +If \code{verbose.call = TRUE} then all the inputted values are accessable via +this component} } \description{ Function to integrate and combine multiple independent studies measured on diff --git a/man/mint.splsda.Rd b/man/mint.splsda.Rd index 1030015b..80c2f4b2 100644 --- a/man/mint.splsda.Rd +++ b/man/mint.splsda.Rd @@ -14,7 +14,8 @@ mint.splsda( tol = 1e-06, max.iter = 100, near.zero.var = FALSE, - all.outputs = TRUE + all.outputs = TRUE, + verbose.call = FALSE ) } \arguments{ @@ -48,6 +49,10 @@ computations. Default value is FALSE.} \item{all.outputs}{Logical. Computation can be faster when some specific (and non-essential) outputs are not calculated. Default = \code{TRUE}.} + +\item{verbose.call}{Logical (Default=FALSE), if set to TRUE then the \code{$call} +component of the returned object will contain the variable values for all +parameters. Note that this may cause large memory usage.} } \value{ \code{mint.splsda} returns an object of class \code{"mint.splsda", @@ -72,6 +77,9 @@ explained variance for each component and each study (note that contrary to PCA, this amount may not decrease as the aim of the method is not to maximise the variance, but the covariance between X and the dummy matrix Y).} +\item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +If \code{verbose.call = TRUE} then all the inputted values are accessable via +this component} } \description{ Function to combine multiple independent studies measured on the same diff --git a/man/pca.Rd b/man/pca.Rd index cf14a08d..017c51f1 100644 --- a/man/pca.Rd +++ b/man/pca.Rd @@ -14,7 +14,8 @@ pca( logratio = c("none", "CLR", "ILR"), ilr.offset = 0.001, V = NULL, - multilevel = NULL + multilevel = NULL, + verbose.call = FALSE ) } \arguments{ @@ -59,11 +60,17 @@ avoid infinite value after the logratio transform.} \item{multilevel}{sample information for multilevel decomposition for repeated measurements.} + +\item{verbose.call}{Logical (Default=FALSE), if set to TRUE then the \code{$call} +component of the returned object will contain the variable values for all +parameters. Note that this may cause large memory usage.} } \value{ \code{pca} returns a list with class \code{"pca"} and \code{"prcomp"} containing the following components: -\item{call}{The function call.} +\item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +If \code{verbose.call = TRUE} then all the inputted values are accessable via +this component} \item{X}{The input data matrix, possibly scaled and centered.} \item{ncomp}{The number of principal components used.} \item{center}{The centering used.} diff --git a/man/pls.Rd b/man/pls.Rd index 130bc0d0..07272582 100644 --- a/man/pls.Rd +++ b/man/pls.Rd @@ -15,7 +15,8 @@ pls( near.zero.var = FALSE, logratio = "none", multilevel = NULL, - all.outputs = TRUE + all.outputs = TRUE, + verbose.call = FALSE ) } \arguments{ @@ -57,11 +58,18 @@ columns indicate those factors. See examplesin \code{?spls}.} \item{all.outputs}{Logical. Computation can be faster when some specific (and non-essential) outputs are not calculated. Default = \code{TRUE}.} + +\item{verbose.call}{Logical (Default=FALSE), if set to TRUE then the \code{$call} +component of the returned object will contain the variable values for all +parameters. Note that this may cause large memory usage.} } \value{ \code{pls} returns an object of class \code{"pls"}, a list that contains the following components: +\item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +If \code{verbose.call = TRUE} then all the inputted values are accessable via +this component} \item{X}{the centered and standardized original predictor matrix.} \item{Y}{the centered and standardized original response vector or matrix.} \item{ncomp}{the number of components included in the model.} diff --git a/man/rcc.Rd b/man/rcc.Rd index e42ffaf1..9350cbf2 100644 --- a/man/rcc.Rd +++ b/man/rcc.Rd @@ -11,7 +11,8 @@ rcc( ncomp = 2, method = c("ridge", "shrinkage"), lambda1 = 0, - lambda2 = 0 + lambda2 = 0, + verbose.call = FALSE ) } \arguments{ @@ -31,6 +32,10 @@ below and reference.} \item{lambda1, lambda2}{a non-negative real. The regularization parameter for the \emph{X} and \emph{Y} data. Defaults to \code{lambda1=lambda2=0}. Only used if \code{method="ridge"}} + +\item{verbose.call}{Logical (Default=FALSE), if set to TRUE then the \code{$call} +component of the returned object will contain the variable values for all +parameters. Note that this may cause large memory usage.} } \value{ \code{rcc} returns a object of class \code{"rcc"}, a list that @@ -45,6 +50,9 @@ canonical variates.} \item{names}{list containing the names to be used for individuals and variables.} \item{prop_expl_var}{Proportion of the explained variance of derived components, after setting possible missing values to zero.} +\item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +If \code{verbose.call = TRUE} then all the inputted values are accessable via +this component} } \description{ The function performs the regularized extension of the Canonical Correlation diff --git a/man/spca.Rd b/man/spca.Rd index 4be2b072..65d79f0c 100644 --- a/man/spca.Rd +++ b/man/spca.Rd @@ -13,7 +13,8 @@ spca( max.iter = 500, tol = 1e-06, logratio = c("none", "CLR"), - multilevel = NULL + multilevel = NULL, + verbose.call = FALSE ) } \arguments{ @@ -51,11 +52,18 @@ specific normalisation in sequencing data. Default to 'none'} \item{multilevel}{sample information for multilevel decomposition for repeated measurements.} + +\item{verbose.call}{Logical (Default=FALSE), if set to TRUE then the \code{$call} +component of the returned object will contain the variable values for all +parameters. Note that this may cause large memory usage.} } \value{ \code{spca} returns a list with class \code{"spca"} containing the following components: \describe{ +\item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +If \code{verbose.call = TRUE} then all the inputted values are accessable via +this component} \item{ncomp}{the number of components to keep in the calculation.} \item{prop_expl_var}{the adjusted percentage of variance diff --git a/man/spls.Rd b/man/spls.Rd index 3adbfdbf..13878671 100644 --- a/man/spls.Rd +++ b/man/spls.Rd @@ -17,7 +17,8 @@ spls( near.zero.var = FALSE, logratio = "none", multilevel = NULL, - all.outputs = TRUE + all.outputs = TRUE, + verbose.call = FALSE ) } \arguments{ @@ -64,10 +65,17 @@ columns indicate those factors. See examples.} \item{all.outputs}{Logical. Computation can be faster when some specific (and non-essential) outputs are not calculated. Default = \code{TRUE}.} + +\item{verbose.call}{Logical (Default=FALSE), if set to TRUE then the \code{$call} +component of the returned object will contain the variable values for all +parameters. Note that this may cause large memory usage.} } \value{ \code{spls} returns an object of class \code{"spls"}, a list that contains the following components: +\item{call}{if \code{verbose.call = FALSE}, then just the function call is returned. +If \code{verbose.call = TRUE} then all the inputted values are accessable via +this component} \item{X}{the centered and standardized original predictor matrix.} \item{Y}{the centered and standardized original response vector or matrix.} \item{ncomp}{the number of components included in the model.} diff --git a/man/tune.block.splsda.Rd b/man/tune.block.splsda.Rd index a29cd337..03818481 100644 --- a/man/tune.block.splsda.Rd +++ b/man/tune.block.splsda.Rd @@ -103,7 +103,7 @@ means and unit variances (default: TRUE)} \item{init}{Mode of initialization use in the algorithm, either by Singular Value Decomposition of the product of each block of X with Y ('svd') or each -block independently ('svd.single'). Default = \code{svd.single}.} +block independently ('svd.single'). Default = \code{svd.single}} \item{light.output}{if set to FALSE, the prediction/classification of each sample for each of \code{test.keepX} and each comp is returned.}