Skip to content

Commit

Permalink
Updated fix for Issue #120
Browse files Browse the repository at this point in the history
bug: when `plotLoadings()` is run on `mint.(s)pls` objects, the inputted `study` parameter is now checked

Prior to this commit, the `check.input.plotLoadings()` call within `plotLoadings.mint.pls()` did not pass the `study` parameter through, meaning that the checks that exist were not being utilised at all
  • Loading branch information
Max-Bladen committed May 3, 2022
1 parent e74bb60 commit 5e9baa9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/plotLoadings.R
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ plotLoadings.mint.pls <-
# if study != "global" then we plot the results on each study

# -- input checks
check = check.input.plotLoadings(object = object, block = c("X", "Y"), title = title, col = col, size.name = size.name, name.var = name.var)
check = check.input.plotLoadings(object = object, block = c("X", "Y"), study = study, title = title, col = col, size.name = size.name, name.var = name.var)

col = check$col
size.name = check$size.name
Expand Down Expand Up @@ -970,7 +970,7 @@ check.input.plotLoadings <- function(object,
if (!is(object, "DA"))
{
block = object$names$blocks
} else if (inherits(object, c("mixo_plsda", "mixo_splsda"))) {
} else if (is(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 (inherits(object, c("mixo_plsda", "mixo_splsda")) & (!all(block %in% c(1,"X")) | length(block) > 1 ))
if (is(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 (inherits(object, c("mixo_plsda", "mixo_splsda","pca")))
if (is(object, c("mixo_plsda", "mixo_splsda","pca")))
{
object$indY = 2
} else if (inherits(object, c("mixo_pls", "mixo_spls"))) {
} else if (is(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 (inherits(object, c("mixo_pls","mixo_spls", "rcc")))# cause pls methods just have 1 ncomp, block approaches have different ncomp per block
if (is(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 5e9baa9

Please sign in to comment.