mixOmics::plotLoadings(splsda.liver, comp = 2, method = 'median', plot = FALSE,
contrib = "max")
Erreur dans names(contrib.df) <- block :
'names' attribute [1] must be the same length as the vector [0]
I don’t seem to encounter the same error you are getting, could you please make sure you are running the latest version of mixOmics (6.30.0)? You can install it from Bioconductor using the command:
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("mixOmics")
Once you’ve installed the latest version, try out this reproducible example code to see if you are still getting the error or if that has solved it.
data(liver.toxicity)
X = as.matrix(liver.toxicity$gene)
Y = as.factor(paste0('treatment_' ,liver.toxicity$treatment[, 4]))
splsda.liver = splsda(X, Y, ncomp = 2, keepX = c(20, 20))
plotLoadings(splsda.liver, comp = 1, method = 'median', contrib = "max") # plot OK
plotLoadings(splsda.liver, comp = 1, method = 'median', contrib = "max", plot = FALSE) # should also work without errors
Please let me know if you are still encountering errors!
Cheers,
Eva
Apparently a conflict was happening between the current mixOmics version (6.30) and an oldest version still present on my machine (6.28). I resolve the issue by deleting all the previous version, and reinstalling the most recent 6.30.