CreateNumeric Vector Method causing an error using R.NET in IronPython

I am using R.NET in IronPython in Visual Studio 2012. The code below works fine:

import clr
from System import *
from System.IO import *
clr.AddReferenceToFileAndPath("C:\\PythonDev\\MSP_Script\\Python\\MSP_Script\\RDotNet.dll")

from RDotNet import *

envPath = Environment.GetEnvironmentVariable("PATH")

rBinPath = "C:\\Program Files\\R\\R-3.0.2\\bin\\i386"
Environment.SetEnvironmentVariable("PATH", envPath + Path.PathSeparator + rBinPath)

engine = REngine.CreateInstance("RDotNet")
engine.Initialize()

group2 = engine.Evaluate("group2 <- c(29.89, 29.93, 29.72, 29.98, 30.02, 29.98)")

But as soon as I add the following line of code:

group1 = engine.CreateNumericVector((30.02, 29.99, 30.11, 29.97, 30.01, 29.99))

I get the error message "AttributeError: object" REngine "does not have attribute" CreateNumericVector ""

If I run the same code in C #, it works fine. I have googled this for some time and cannot find any pointers. Any help would be greatly appreciated.

+4
source share
1 answer

, , REngine, , . , :

from RDotNet import REngineExtension
clr.ImportExtensions(REngineExtension)
+1

Source: https://habr.com/ru/post/1526033/


All Articles