Skip to content

Commit

Permalink
fix: api: is -> inherits. Resolves #208
Browse files Browse the repository at this point in the history
  • Loading branch information
Al Abadi committed Apr 10, 2022
1 parent 255b427 commit e8bac30
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion R/plotIndiv.pls.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ plotIndiv.mixo_pls <-
size.axis = size.axis, size.legend = size.legend, size.legend.title = size.legend.title, legend.title = legend.title,
legend.title.pch = legend.title.pch, legend.position = legend.position, point.lwd = point.lwd)

if (is(object, c("mint.block.pls", "mint.block.spls", "mint.block.plsda", "mint.block.splsda")))
if (inherits(object, c("mint.block.pls", "mint.block.spls", "mint.block.plsda", "mint.block.splsda")))
stop("No plotIndiv for the following functions at this stage: mint.block.pls, mint.block.spls, mint.block.plsda, mint.block.splsda.")

#-- choose rep.space
Expand Down
10 changes: 5 additions & 5 deletions R/plotLoadings.R
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,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 @@ -968,13 +968,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 @@ -1189,7 +1189,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
2 changes: 1 addition & 1 deletion R/predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ predict.mixo_pls <-

# input parameter: noAveragePredict=> no averagePredict calculation, used in tune.block.splsda

if(is(object, c("rgcca","sparse.rgcca")))
if(inherits(object, c("rgcca","sparse.rgcca")))
stop("no prediction for RGCCA methods")

#check on dist
Expand Down

0 comments on commit e8bac30

Please sign in to comment.