5

I'm really having problems with RStudio. It had been working fine a few days ago. Then it said I needed the newest version of RTools. I tried to install it but don't think it was successful. However now I can't load anything in R. I am greeted with the following message when launching RStudio:

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

During startup - Warning message:
package ‘stats’ in options("defaultPackages") was not found 
Error in inDL(x, as.logical(local), as.logical(now), ...) : 
  unable to load shared object 'C:/Program Files/R/R-3.6.3/library/stats/libs/x64/stats.dll':
  LoadLibrary failure:  The specified module could not be found.

I have looked up solutions to this problem and people say to delete /Renviron but I don't know will that mess things up even more.

Here are a few results of things I type into R:

> Sys.getenv("PATH")
[1] "C:\rtools40"
> Sys.which("stats.dll")
stats.dll 
       "" 
> Sys.which("make")
make 
  "" 

I really don't understand what has gone wrong. Can anyone help?

Phil
  • 7,287
  • 3
  • 36
  • 66
daisy
  • 61
  • 1
  • 6
  • What's currently in your Renviron file? (it's just a text file). Your version of R and Rtools should match. Right now it seems like you are running R3.6 but are using Rtools 4.0 – MrFlick Dec 13 '20 at 18:41
  • @MrFlick when I open up Renviron in R it just says PATH="C: tools40". Do you have any suggestions what I can do? – daisy Dec 14 '20 at 00:22
  • I would try updating your R to the lasted version. You seem to have a mismatch between the two programs at the moment. – MrFlick Dec 14 '20 at 01:11

1 Answers1

0

You accidentally overwrote the PATH envvar. Your line in .Renviron must be: PATH="C:/rtools40/usr/bin;${PATH}" (mind the " and the {}), otherwise you'll lose the R installation path and R will not be able to load the shared library.

Banus80
  • 101
  • 1
  • 8