1

[![ Hi there!!

I am using R 4.0.5 on a windows 10 OS

I have installed rtools40-x86_64 and used the following command to put the location of the make it utilities as recommanded here

writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

However after restarting R, it gave me the error on the picture below. or the following

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-4.0.5/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-4.0.5/library/stats/libs/x64/stats.dll':
  LoadLibrary failure:  The specified module could not be found.

I have uninstalled R, RStudio, Rtools, deleted all related files in C, Documents, and RStudio registry, and reinstalled there after. But the same error persist.

In a related post they made mentioned of missing binaries, and I used the command

install.packages("stats", type = "binary")

but it was negative.

I tried updating stats package, but once I call it it gives the same error.

> update.packages("stats")
> library(stats)
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-4.0.5/library/stats/libs/x64/stats.dll':
  LoadLibrary failure:  The specified module could not be found.

Every package which requires stats package gives the exact same error.

Does anyone have any idea on how to overcome this challenge?

Thanks in advance. ]3]3

Andy
  • 21
  • 1
  • 3

3 Answers3

0

I have installed a previous version of R (3.6.0) and a previous version of Rtools (.35) and that message disappeared. I have not tried any other R version.

Andy
  • 21
  • 1
  • 3
  • I also work around the issue by reverted to my previous version (R 4.0.3), but would like to know how to get a functional updates. – nefosl May 11 '21 at 13:41
0

I’ve seen many suggestions here and elsewhere suggesting to delete the .Renviron files. I deleted .Renviron locally with no success. However, I found an additional two .Renviron file in my OneDrive folder.

After deleting these files in OneDrive and reinstalling the most recent versions of R and rtools I was able to avoid the ‘stats.dll’ error.

James Adler
  • 1
  • 1
  • 1
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 27 '22 at 00:25
-1

Go to files. Delete the .Renviron file that you created and it will work.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
  • I have the same issue as Andy. Deleting the .Renviron file does not fix it. – nefosl May 11 '21 at 13:38
  • Contributor [@Halima](https://stackoverflow.com/users/16352232/halima) reports that this works in R 4.1.0 on Windows 10. (They posted this as [a repeat answer](https://stackoverflow.com/a/68198900/3025856), so I'm reiterating their confirmation here since I assume their answer will get deleted.) – Jeremy Caney Jul 02 '21 at 01:37