Skip to content

Commit

Permalink
Updated fix for Isssue #120
Browse files Browse the repository at this point in the history
bug: brought the output of `plotLoadings()` on MINT objects in line with the other methods

Within `plotLoadings.mint.pls()`, adjusted the value of `block` in the `plotLoadings.mixo_pls()` call. This means that both the `X` and `Y` loading values are returned, rather than just `X`
  • Loading branch information
Max-Bladen committed May 2, 2022
1 parent 9512ea4 commit e74bb60
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions R/plotLoadings.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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")))
Expand Down Expand Up @@ -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))
Expand All @@ -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
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e74bb60

Please sign in to comment.