nlv
nlv

Reputation: 831

Base R library not loading in VS

Situation: I have installed R 3.3 and set up R for Visual Studio extension.

Code snippet:

 log.ir <- log(iris[, 1:4])
 ir.species <- iris[, 5]
 ir.pca <- stats:::prcomp(log.ir, center = TRUE, scale = TRUE)

This works in R interactive window in Visual Studio, it also work in RGui but when I run it using C# the code fails on 3rd line:

engine.Evaluate("log.ir <- log(iris[, 1:4])");
engine.Evaluate("ir.species <- iris[, 5]");
engine.Evaluate("ir.pca <- stats:::prcomp(log.ir, center = TRUE, scale = TRUE)");

Exception:

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

Visual Studio error running R code

I have tried reinstalling all R components but it hasn't helped. And obviously I have checked and the stats.dll file exists in the path specified in the error.

RTVS version: enter image description here

Any help is much appreciated, Thanks

Upvotes: 2

Views: 1770

Answers (3)

Waglio
Waglio

Reputation: 1

This was the correct solution for me after my computer crashed and I had to reload everything. Between the time I had developed 3 new programs and the time of the crash, R-3.4.3 came out and the new version did not work with my programs. I used the CRAN "Time Machine" and reinstalled an earlier version and everything worked just fine.

Upvotes: -1

Milan Pračko
Milan Pračko

Reputation: 78

I have been in same problem like you. I could not to load my base R dll functions. After two days of researching finally I found one question solving my problem:

https://github.com/jmp75/rdotnet/issues/62

Solution is very easy: in R-3.4.3 does not work properly reading path to your R folder, you can use R-3.4.2 and wait for correction in new R version :D - or rewrite R_Home environment variable.

Upvotes: 1

Michael Bond
Michael Bond

Reputation: 151

I encountered this recently and the solution to this seems to be relatively straightforward. All you need to do is add the path to the R.dll from the relevant architecture (i386/x64)to the System Path statement. So, on my system I added "C:\Program Files\R\R-3.4.0\bin\i386" to the System Path Environment Variable. I also forced the architecture to x86, but that could just be overkill.

This information was gleaned from ASP.NET with R.NET

Upvotes: 1

Related Questions