Stewart Doberman
Stewart Doberman

Reputation: 43

Cannot load forecast or RcppArmadillo packages from Script

When I run the commands library(forecast) and library(RcppArmadillo), there is no error. However, when I try to run these commands from a script, my script is unable to execute.

There are a few nuances to this case. Firstly, I only encounter this error on machines with R version > 2.14. I successfully ran this script on R 2.13.0, and encountered the error on machines with R version 2.14.1 and 2.14.2.

Additionally, the command find.package("forecast"), and similarly find.package("RcppArmadillo") does not return an error from inside the script, meaning that the script can locate the packages but cannot load them.

I have successfully ran a script replacing library(forecast) with the following 6 other packages: Rcpp, tseries,fracdiff,qcc,quadprog, zoo, and parallel.

Does anyone know why I cannot load these two packages from a script even though I can load them in the R console, and why this error occurs only for R versions > 2.14? My initial thought was that it might be related to the fact that these packages depend on R>=2.14.

Thank You Very Much.

Upvotes: 1

Views: 921

Answers (1)

Stewart Doberman
Stewart Doberman

Reputation: 43

We found that the issue was that RcppArmadillo depends on the Rlapack.dll file, which the script was not able to locate when loading the library. The solution was to copy the Rlapack.dll file to the library/RcppArmadillo/libs/i386 subfolder. After making this change, we were able to successfully execute our script.

We have two questions about this issue.

1) Why, when executing via R console, were we able to locate the Rlapack.dll file, when, during script execution, we were unable to find the dependent file?

2) Why did this issue occur only in R > 2.14? Was this a result of an update to either the RcppArmadillo or forecast packages?

Upvotes: 2

Related Questions