F# R 提供程序:找不到方法:'RDotNet.REngine RDotNet.REngine.GetInstance

F# R Provider: Method not found: 'RDotNet.REngine RDotNet.REngine.GetInstance

我在 REPL 中像这样使用 R Type Provider

#r "../packages/FSharp.Data.2.2.0/lib/net40/FSharp.Data.dll"
open FSharp.Data

[<Literal>]
let uri = "https://reddoggabtest-secondary.table.core.windows.net/TestTelemetryData0?tn=TestTelemetryData0&sv=2014-02-14&si=GabLab&sig=GGc%2BHEa9wJYDoOGNE3BhaAeduVOA4MH8Pgss5kWEIW4%3D"

type CarTelemetry = XmlProvider<uri>
let carTelemetry = CarTelemetry.Load(uri)

#r "C:/Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.5.1/System.Xml.Linq.dll"
open System.Xml.Linq

carTelemetry.Entries |> Seq.iter(fun e -> printfn "%A" e.Title)

#I "../packages/RProvider.1.1.8/lib"
#r "../packages/R.NET.1.5.5/lib/net40/RDotNet.dll"
#r "../packages/R.NET.1.5.5/lib/net40/RDotNet.NativeLibrary.dll"
#r "../packages/R.NET.Community.FSharp.0.1.9/lib/net40/RDotNet.FSharp.dll"
#r "../packages/RProvider.1.1.8/lib/net40/RProvider.dll"
#r "../packages/RProvider.1.1.8/lib/net40/RProvider.Runtime.dll"

open System
open System.Net

open RDotNet
open RProvider
open RProvider.graphics
open RProvider.stats

carTelemetry.Entries |> Seq.map(fun e -> e.Content.Properties.Acceleration.Value)
                     |> R.log
                     |> R.diff

当我执行它时,我得到这个异常

System.MissingMethodException: Method not found: 'RDotNet.REngine RDotNet.REngine.GetInstance(System.String, Boolean, RDotNet.StartupParameter, RDotNet.Devices.ICharacterDevice)'.
   at RProvider.Internal.RInit.engine@114.Invoke()
   at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Lazy`1.get_Value()
   at RProvider.RInteropInternal.toR(Object value) in c:\Tomas\Public\FSharp.RProvider\src\RProvider\RInterop.fs:line 287
   at RProvider.RInterop.passArg@447(List`1 tempSymbols, Object arg) in c:\Tomas\Public\FSharp.RProvider\src\RProvider\RInterop.fs:line 461
   at RProvider.RInterop.argList@468-1.GenerateNext(IEnumerable`1& next) in c:\Tomas\Public\FSharp.RProvider\src\RProvider\RInterop.fs:line 475
   at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
   at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System-Collections-IEnumerator-MoveNext()
   at Microsoft.FSharp.Collections.SeqModule.ToArray[T](IEnumerable`1 source)
   at RProvider.RInterop.callFunc(String packageName, String funcName, IEnumerable`1 argsByName, Object[] varArgs) in c:\Tomas\Public\FSharp.RProvider\src\RProvider\RInterop.fs:line 466
   at <StartupCode$FSI_0012>.$FSI_0012.main@()
Stopped due to error

有什么想法吗?谢谢

这看起来有些版本不匹配 - 您在 packages 文件夹中安装了 R.NET 的什么版本?

正确的(根据latest R provider NuGet package的要求)是:

  • R.NET.社区 (= 1.5.16)
  • R.NET.Community.FSharp (= 0.1.9)

请注意,还有(令人困惑的)较旧的 R.NET 包(没有 "Community" 位)并且在 packages 中包含它可能会使 R 提供者感到困惑。

顺便说一句:您也可以尝试使用 FsLab templates,这使得安装和加载所有内容的过程变得更加简单 - 将所有内容减少到一个 #load :-)