Hi,
Thanks for your reply. I found out what the problem was and thought it best to explain in case someone else has the same problem. I have 2 versions of R installed on my machine(2.14.1 and 2.9.0). I was setting the path variable to 2.14.1 version but it seemed the engine was getting the home path from the 2.9.0 version and I believe it was looking in a drive I don't even have for the libs path? After I specified the R_LIBS and R_HOME paths it all worked fine.
Thanks for your reply. I found out what the problem was and thought it best to explain in case someone else has the same problem. I have 2 versions of R installed on my machine(2.14.1 and 2.9.0). I was setting the path variable to 2.14.1 version but it seemed the engine was getting the home path from the 2.9.0 version and I believe it was looking in a drive I don't even have for the libs path? After I specified the R_LIBS and R_HOME paths it all worked fine.
// Set the folder in which R.dll locates.
var envPath = Environment.GetEnvironmentVariable("PATH");
var rBinPath = @"C:\Program Files\R\R-2.14.1\bin\i386";
Environment.SetEnvironmentVariable("PATH", envPath + Path.PathSeparator + rBinPath);
Environment.SetEnvironmentVariable("R_LIBS", @"C:\Program Files\R\R-2.14.1\library");
Environment.SetEnvironmentVariable("R_HOME", @"C:\Program Files\R\R-2.14.1");
engine = REngine.CreateInstance("RDotNet");
Thanks