library function not working -- PATHS error?

Error: package or namespace load failed for ‘ggplot2’ in inDL(x, as.logical(local), as.logical(now), ...):
 unable to load shared object 'C:/Program Files/R/R-4.1.1/library/stats/libs/x64/stats.dll':
  LoadLibrary failure:  The specified module could not be found.

I followed the steps linked at bottom ot this paragraph for the Windows 10 issue regarding saving files to one drive. I also used the code “setwd(C:/R Folder”) and tested it with “getwd()” which returned “[1] "C:/R Folder"”.

I have a .Renviron file in the Working Directory with the following text:

#DEFAULTS (from install; found using Sys.getenv() )
R_DOC_DIR C:/PROGRA~1/R/R-41~1.1/doc
R_HOME C:/PROGRA~1/R/R-41~1.1
R_LIBS_USER C:/Users/tasny/OneDrive/Documents/R/win-library/4.1
R_USER C:/Users/tasny/OneDrive/Documents
PATH C:\rtools40/C:/rtools40;
HOME C:/Users/tasny/OneDrive/Documents

The R files are (default) installed to the path:

C:/Program Files/R/R-4.1.1

RStudio files located here:

C:/Program Files/RStudio

RTools files located here:


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.