diff --git a/R/plotLoadings.R b/R/plotLoadings.R index 1fb7aef2..4d6b45b6 100644 --- a/R/plotLoadings.R +++ b/R/plotLoadings.R @@ -532,7 +532,7 @@ plotLoadings.mint.pls <- if(any(study == "global")) { # if study == "global" then we plot the results on the concatenated data, thus direct call to plotLoadings.plsda - plotLoadings.mixo_pls(object = object, block = "X", comp = comp, ndisplay = ndisplay, + plotLoadings.mixo_pls(object = object, block = c("X", "Y"), comp = comp, ndisplay = ndisplay, size.name = size.name, name.var = name.var, name.var.complete = name.var.complete, @@ -549,11 +549,11 @@ plotLoadings.mint.pls <- # if study != "global" then we plot the results on each study # -- input checks - check = check.input.plotLoadings(object = object, block = "X", title = title, col = col, size.name = size.name, name.var = name.var) + check = check.input.plotLoadings(object = object, block = c("X", "Y"), title = title, col = col, size.name = size.name, name.var = name.var) col = check$col size.name = check$size.name - block = check$block # "X" + block = check$block # c("X", "Y") #study needs to be either: from levels(object$study), numbers from 1:nlevels(study) or "global" if (any(!study%in%c(levels(object$study), "global" , "all.partial"))) @@ -970,7 +970,7 @@ check.input.plotLoadings <- function(object, if (!is(object, "DA")) { block = object$names$blocks - } else if (is(object, c("mixo_plsda", "mixo_splsda"))) { + } else if (inherits(object, c("mixo_plsda", "mixo_splsda"))) { block = "X" } else { if (!is.null(object$indY)) @@ -982,13 +982,13 @@ check.input.plotLoadings <- function(object, } } - if (is(object, c("mixo_plsda", "mixo_splsda")) & (!all(block %in% c(1,"X")) | length(block) > 1 )) + if (inherits(object, c("mixo_plsda", "mixo_splsda")) & (!all(block %in% c(1,"X")) | length(block) > 1 )) stop("'block' can only be 'X' or '1' for plsda and splsda object") - if (is(object, c("mixo_plsda", "mixo_splsda","pca"))) + if (inherits(object, c("mixo_plsda", "mixo_splsda","pca"))) { object$indY = 2 - } else if (is(object, c("mixo_pls", "mixo_spls"))) { + } else if (inherits(object, c("mixo_pls", "mixo_spls"))) { object$indY = 3 # we don't want to remove anything in that case, and 3 is higher than the number of blocks which is 2 } @@ -1203,7 +1203,7 @@ get.loadings.ndisplay <- function(object, #comp # ---- - if (is(object, c("mixo_pls","mixo_spls", "rcc")))# cause pls methods just have 1 ncomp, block approaches have different ncomp per block + if (inherits(object, c("mixo_pls","mixo_spls", "rcc")))# cause pls methods just have 1 ncomp, block approaches have different ncomp per block { ncomp = object$ncomp object$X = list(X = object$X, Y = object$Y) # so that the data is in object$X, either it's a pls or block approach