Multilevel PLSDA error (rowSums)

Dear Team,
I’m trying to use multilevel PLSDA for metabolomics data and get an error on ‘rowSums’ every time I add the multilevel argument. Simple PLSDA works fine. Kindly help me!

Below is the error reproduced using the mixOmics package example. I’m using the R version 4.3.0 (2023-04-21) and mixOmics version 6.24.0.

suppressMessages(library(mixOmics))
data(vac18)
X ← vac18$genes
Y ← vac18$stimulation
design ← data.frame(sample = vac18$sample)
res ← plsda(X,Y,multilevel = design)
Error in rowSums(Y) : ‘x’ must be an array of at least two dimensions

Traceback:

traceback()
6: stop(“‘x’ must be an array of at least two dimensions”)
5: rowSums(Y)
4: which(rowSums(Y) == 0)
3: Check.entry.pls(X, Y, ncomp, keepX, keepY, mode = mode, scale = scale,
near.zero.var = near.zero.var, max.iter = max.iter, tol = tol,
logratio = logratio, DA = DA, multilevel = multilevel)
2: internal_wrapper.mint(X = X, Y = Y.mat, ncomp = ncomp, scale = scale,
near.zero.var = near.zero.var, mode = “regression”, max.iter = max.iter,
tol = tol, logratio = logratio, multilevel = multilevel,
DA = TRUE, all.outputs = all.outputs)
1: plsda(X, Y, multilevel = design)

hi @Metabo,

Thanks for reporting this bug (it is a bug!).

I have used the R cloud (it is easy to get a login) and tested a few R versions. For some reason R version 4.3.1 (the most recent) leads to the bug you reported. But version R 4.2.3 works (corresponding to mixOmics 6.22.0).

If you wanted to go forward, I’d recommend you use R cloud and set the R version you need (top right corner).

Also, it is possible that you do not need a multilevel analysis. We first run a classic PCA to assess whether there is a repeated measure effect before moving to multilevel (see also past posts about multilevel - we are facing some issues at the moment).

I am not sure at this stage when we can resolve the bug you mentioned… (no capacity!)

Kim-Anh

Hello @kimanh.lecao,

I have now used R 4.2.3 in R cloud and it worked! I wanted to do the multilevel PLSDA as I had 3 time points- patients (before and after treatment) and matched controls.

Thank you!