介意,我在F#和R(更何况)一个初学者,所以可能指向我RTFM或以其他方式;-)F#,R提供商,R包TM和(几乎)奥维例如
我已经开始用R来研究一些文本数据挖掘,以及包tm。
我在R中有以下脚本,它的方式非常类似于Ovid分析的示例(用“txt”替换实际示例中的“lgtext”,language =“lat”替换语言=“no”使用Ovid示例运行它):
library(tm)
library(SnowballC)
txt <- system.file("texts", "lgtextfull", package = "tm")
(lgorg <- VCorpus(DirSource(txt, encoding = "UTF-8"),
readerControl = list(language = "no")))
lg <- tm_map(lgorg , stripWhitespace)
因此,作为初学者,我使用了F#,R,Deedle和RPRovider。 Deedle我还没有使用的又是那么这可以被忽略不计......
我试着再写出下面的F#:
#I "../packages/RProvider.1.0.17/"
#load "RProvider.fsx"
open RProvider
open RDotNet
open RProvider.``base``
open RProvider.tm
open RProvider.openNLP
open RProvider.SnowballC
let txt = R.system_file("texts", "lgtextfull", package = "tm", lib_loc = null, mustWork=true)
let lang = dict [("language", "no":>obj)]
let readerControl = R.list(lang)
let dirsource = R.DirSource(txt, encoding = "UTF-8")
let lgorg = R.VCorpus(dirsource, readerControl)
let lg = R.tm__map(lgorg, R.stripWhitespace)
原因“扩展”将R剧本与其说是对我的理解和让它起作用。
一些来回后,上面会运行和apperently它的工作原理和报告REPL相同R,到最后一行的exeption:
let lg = R.tm__map(lgorg, R.stripWhitespace)
这给出了一个错误,如:
System.Exception: No converter registered for type [email protected] or any of its base types
at [email protected](String message) in c:\Tomas\Public\FSharp.RProvider\src\RProvider\RInterop.fs:line 164
at [email protected][b,c,d](String fmt, Int32 len, FSharpFunc`2 outputChar, FSharpFunc`2 outa, b os, FSharpFunc`2 finalize, FSharpList`1 args, Int32 i)
at [email protected][b,c,d](FSharpFunc`2 initialize, String fmt, Int32 len, FSharpList`1 args)
at [email protected][b,c,d](FSharpFunc`2 initialize, String fmt, Int32 len, FSharpList`1 args, Type ty, Int32 i)
at <StartupCode$FSharp-Core>[email protected](T1 inp)
at RProvider.RInteropInternal.REngine.SetValue(REngine this, Object value, FSharpOption`1 symbolName) in c:\Tomas\Public\FSharp.RProvider\src\RProvider\RInterop.fs:line 274
at RProvider.RInteropInternal.toR(Object value) in c:\Tomas\Public\FSharp.RProvider\src\RProvider\RInterop.fs:line 287
at [email protected](List`1 tempSymbols, Object arg) in c:\Tomas\Public\FSharp.RProvider\src\RProvider\RInterop.fs:line 445
at [email protected](IEnumerable`1& next) in c:\Tomas\Public\FSharp.RProvider\src\RProvider\RInterop.fs:line 453
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 450
at RProvider.RInterop.call(String packageName, String funcName, String serializedRVal, Object[] namedArgs, Object[] varArgs) in c:\Tomas\Public\FSharp.RProvider\src\RProvider\RInterop.fs:line 494
at <StartupCode$FSI_0006>[email protected]() in C:\Users\helgeu\Documents\Visual Studio 2012\Projects\DisqusAnalyzer\DisqusAnalyzer.Lib\InteractiveSession.fsx:line 81
Stopped due to error
我必须承认,我对此一无所知,google.com也不帮我;-)
有人吗?任何指针?它应该工作吗?我做错了吗?
现在我看到它解释说它对我有意义。我还没有看过它,但是我确实尝试了一个像你所描述的那样快的方法,而且它也没有像预期的那样工作。有一些成功,如stackoverflow.com/questions/28498549/...中所述,所以我会仔细研究并尝试一些更多选项,并可能会发布一些跟进。我有强烈的怀疑,我试图在F#中编写R,而不是在F#中使用R。总之:THX! – 2015-02-17 07:44:38