I ran into a problem using MOFA2 inside an R console session and then trying to knit an Rmarkdown script. Specifically, whenever I try to knit anything within RStudio after calling "run_mofa", the knit fails at the first point that it encounters any function in one of the standard default packages (stats, utils, etc.). I filed a bug report with RStudio. Working with someone there, we found that the call to run_mofa causes a new environmental variable to be set:
R_DEFAULT_PACKAGES: NULL
This variable is not set when I start an R session, nor is set after simply loading the library package. It only exists after calling "run_mofa". It persists in the separate R sessions started when invoking "knit" from the button in RStudio. This value of the variable prevents loading of the standard packages.
I would (strongly) suggest unsetting or restoring any global environment variables that were changed within the scope of the function before exiting the function. At the very least, this phenomenon should be documented somewhere in case other people run into the same problem.