Rstudio cannot import packages in R Markdown

Hi all,

I get various errors when importing packages in R Markdown which do not emerge when no R Markdown files are opened. Some examples:

> library(dplyr)
Error: package or namespace load failed for ‘dplyr’ in x[["path"]]:
 invalid subscript type 'closure'
> library(RMySQL)
Loading required package: DBI
Error: package or namespace load failed for ‘RMySQL’ in is(fdef, "genericFunction"):
 object 'class2' not found
> library(ggcyto)
Loading required package: flowCore
Error: package or namespace load failed for ‘flowCore’ in .identC(class(class2Def), "classRepresentation"):
 object 'class2Def' not found
Error: package ‘flowCore’ could not be loaded
> library(ggcyto)
Loading required package: ggplot2
Loading required package: flowCore
Error: package or namespace load failed for ‘flowCore’ in is(prev, "classRepresentation"):
 'rho' must be an environment not pairlist: detected in C-level eval
Error: package ‘flowCore’ could not be loaded

As you may see from the last two examples different errors might appear for the same package on different start up. I can import packages before opening an R Markdown file but then Rstudio crashes after running a chunk producing a plot.

I've tried reinstalling rmarkdown, Rstudio, R, all the packages and nothing worked. Would love any advice.

Session info:

R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.0.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.1.2 tools_4.1.2

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.