Multilevel PLSDA error

Dear Team,
I’m trying to use multilevel PLSDA for paired 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 try to use the R version R 4.3.2 or R 4.2.3 ,both could got the same error. (mixOmics version 6.26.0.)

##data: 24col* 10row dataframe: the first column named “sample” is the different samples (5 samples totally: 1,2,3,4,5,1,2,3,4,5. Same sample figure means the data from the same sample but different timepoint. The fisrt 1-5 are from timepoint1, the second 1-5 are from timepoint2). The second column named Timepoint include two timepoints: T1,T1,T1,T1,T1,T2,T2,T2,T2,T2. The rest 22coloun are the different markers. (some have NA)

Code:
delete<-c(1,2)
X<- final.data[, -delete]
Y<- as.factor(data$Timepoint)
pls<- plsda(X, Y, multilevel = data$sample, ncomp = 2)

Error in rowSums(Y) : ‘x’ must be an array of at least two dimensions

And I also wander these code I write instead are right or not:
delete<-c(1,2)
X<- data[, -delete]
Y<- as.factor(data$Timepoint)
design<-data.frame(sample=data$sample)
Xw ← withinVariation(X, design)
pls<- plsda(Xw, Y, ncomp = 2)

Thank you so much. I would appreciate your valuable feedback.

hi @Wennie,

Both codes are ok, check that the length of Y and data$sample is 10?
Also check you have a latest version of the package (if the update is too cumbersome, you can use the RStudio cloud online).

I can have a quick look if you send me the .RData with your code (via email).

Kim-Anh

I am having the same Issue in a script that ran successfully 6 months ago.
Error in rowSums(Y) : ‘x’ must be an array of at least two dimensions…

Y ← Train.Met$Time
design ← data.frame(Sample= Train.Met$NDPNum)
splsda.SG ← splsda(X.Met, Y, ncomp = optimal.ncomp,
keepX = optimal.keepX,
multilevel = design)

length(Y)
[1] 160
length(Train.Met$NDPNum)
[1] 160
I am running the most updated version of MixOmics.
Is there a solution?

Thanks for your reply! May I ask your email adress then I could send my data to you to test. :blush:

hi @jlabus

We might be able to have look in a month or so. No changes have happened in the past 6 months so I am not sure what is happening.

Kim-Anh