Reproducible example to clarify issues

One of the most important things to do when reporting an issue is to provide an example in which the issue occurs. This helps developers to quickly get to the issue itself, instead of trying to create that error/condition which sometimes takes most of the time if we don’t know the context. Therefore, if your question relates to any unusual behaviour from mixOmics, we would like you to follow these steps:

0) Ensure you have the latest version of mixOmics

Check your package version:

packageVersion('mixOmics')
#> [1] ‘?.?.?’

And compare against the following:



refer to GitHub - mixOmicsTeam/mixOmics: Development repository for the Bioconductor package 'mixOmics ' for installation instructions.

Also, consider the devel branch and ensure that the issue has not been resolved in the latest development version. Restart R after any new installation before re-trying.

If the issue persists. carry on to the next steps.

1) use mixOmics datasets to produce a reproducible example (or see 5)

For instance:

suppressMessages(library(mixOmics))
data("breast.TCGA")
X <- breast.TCGA$data.train$mrna
Y <- breast.TCGA$data.train$subtype
Y[1] <- Inf ## add invalid Y to get error
#> Warning message:
#> In `[<-.factor`(`*tmp*`, 1, value = Inf) :
#>  invalid factor level, NA generated
res <- plsda(X = X, Y = Y)
plotIndiv(res)
#> Error: Unknown colour name: FALSE

There are many examples for all mixOmics functions. For example ?mixOmics::plsda will guide to you to the help file for the pslda function where you can find an example and alter it so that it would produce the problematic behaviour (say, by changing Y so that it has an Inf value in the example above). Sometimes this step automatically identifies the culprit!

2) use reprex package to render your reproducible example

Once your reproducible example is ready and you have installed the reprex package (for installation refer to Prepare Reproducible Example Code via the Clipboard • reprex), simply copy the code that creates the behaviour onto the clipboard and type in the RStudio console (not in the main code/editor) the following:

reprex::reprex(si=TRUE)

See https://youtu.be/99KkDhdFGnc for a quick demo on this.

This will use the code in the clipboard to create a rendered code with the results (including hyperlinked images) back onto the clipboard. Note that the call to library(mixOmics) should also be included in the copied code. The argument si=TRUE includes your sessioninfo() so we’d know which software versions you are using. See Prepare Reproducible Example Code via the Clipboard • reprex for more on reprex.

Check the pasted code in your clipboard to ensure it is producing the problematic condition/behaviour and paste it in the issue statement.

3) clarify what is your expected behaviour and what you actually observe along with the code

For instance, “I was expecting the number of selected variables would match those provided in keepX but I see that there’s more”.

4) Share your suggestions or thoughts on what could be the culprit/solution

If you have any suggestions/thoughts that might be useful, please feel free to share with us. That is a big help at times!

5) Email us (a subset of) your data and reproducible code if all fails

If you are unable to reproduce the behaviour using mixOmics data, please send us your scripts along with all the used data so we can reproduce and fix the issue. You can subset your data if they are too large but you need to ensure the behavior resurfaces using the subset too. All inputs used must be sent to us to reproduce the behaviour. Your files will be completely confidential and destroyed safely after the issue is resolved. You can click on this text to send us an email. Alternatively, you can right-click on the above text and choose ‘Copy Email Address’

1 Like