當前位置: 首頁>>代碼示例>>C#>>正文


C# REngine.CreateCharacterVector方法代碼示例

本文整理匯總了C#中RDotNet.REngine.CreateCharacterVector方法的典型用法代碼示例。如果您正苦於以下問題:C# REngine.CreateCharacterVector方法的具體用法?C# REngine.CreateCharacterVector怎麽用?C# REngine.CreateCharacterVector使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在RDotNet.REngine的用法示例。


在下文中一共展示了REngine.CreateCharacterVector方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TestPendingFinalizersThreadingIssues

 private static void TestPendingFinalizersThreadingIssues(REngine e)
 {
     e.Evaluate("f <- function(a) {if (length(a)!= 1) stop('What goes on?')}");
     var f = e.Evaluate("f").AsFunction();
     try
     {
         e.Evaluate("f(letters[1:3])");
     }
     catch (EvaluationException)
     {
     }
     f.Invoke(e.CreateCharacterVector(new[] { "blah" }));
     try
     {
         f.Invoke(e.CreateCharacterVector(new[] { "blah", "blah" }));
     }
     catch (EvaluationException)
     {
         Console.WriteLine("Caught the expected exception");
     }
     f = null;
     GC.Collect();
     GC.WaitForPendingFinalizers();
     e.Dispose();
     Console.WriteLine("Just waiting for crash...");
     GC.Collect();
     GC.WaitForPendingFinalizers();
 }
開發者ID:xumaoxuan,項目名稱:rdotnet,代碼行數:28,代碼來源:Program.cs

示例2: GenetateLatencyVsMessageLengthPlot_RScript

        static void GenetateLatencyVsMessageLengthPlot_RScript(REngine engine, string latencyCsvFilename)
        {
            //For formatting purposes, make sure the filename is acceptable for R function read.csv
            string fileToReadFromCommand = latencyCsvFilename.Replace(@"\", @"/");

            //Convert to R character vector
            CharacterVector cvFilename = engine.CreateCharacterVector(new[] { fileToReadFromCommand });
            // and assign it to variable (in R engine) called fileToReadFrom
            engine.SetSymbol("fileToReadFrom", cvFilename);

            //And then evaluate the script - this uses the 'fileToReadFrom' in a read.csv call
            engine.Evaluate(MyRDotNetApplication.Properties.Resources.latencyVsMessageLengthScatterPlot); //R-Script to generate plot
        }
開發者ID:simonmackinnon,項目名稱:CSharpSnippets,代碼行數:13,代碼來源:MyRDotNetApplication.cs

示例3: ReproInMemoryDataFrameCreation

        private static void ReproInMemoryDataFrameCreation(REngine e)
        {
            e.Evaluate("f <- function(a) {if (length(a)!= 1) stop('What goes on?')}");
             var f = e.Evaluate("f").AsFunction();
             try
             {
            e.Evaluate("f(letters[1:3])");
             }
             catch (EvaluationException)
             {
             }
             f.Invoke(e.CreateCharacterVector(new[] { "blah" }));
             f.Invoke(e.CreateCharacterVector(new[] { "blah", "blah" }));

             // IEnumerable[] columns, string[] columnNames = null, string[] rowNames = null, bool checkRows = false, bool checkNames = true, bool stringsAsFactors = true);
             var columns = new[] {
            new[]{1,2,3,4,5},
            new[]{1,2,3,4,5},
            new[]{1,2,3,4,5}
             };
             var df = e.CreateDataFrame(columns, new[] { "a", "b", "c" });
             columns[1] = new[] { 1, 2, 3 };
             object blah;
             try
             {
            df = e.CreateDataFrame(columns, new[] { "a", "b", "c" });
            blah = df[1, 1];
             }
             catch
             {
             }
             df = e.CreateDataFrame(columns, new[] { "a", "b", "c" });
             blah = df[1, 1];
        }
開發者ID:jmp75,項目名稱:rdotnet-support,代碼行數:34,代碼來源:Program.cs

示例4: CreateCharacterVector

 public static void CreateCharacterVector(REngine engine, int n, Stopwatch s)
 {
     string[] d = createStringArray(n);
     s.Start();
     var nvec = engine.CreateCharacterVector(d);
     s.Stop();
 }
開發者ID:mgtstrategies,項目名稱:rdotnet,代碼行數:7,代碼來源:RuntimeDiagnostics.cs

示例5: ToVector

        internal static SymbolicExpression ToVector(REngine engine, IEnumerable values)
        {
            if (values == null) throw new ArgumentNullException("values", "values to transform to an R vector must not be null");
            var ints = values as IEnumerable<int>;
            var chars = values as IEnumerable<string>;
            var cplxs = values as IEnumerable<Complex>;
            var logicals = values as IEnumerable<bool>;
            var nums = values as IEnumerable<double>;
            var raws = values as IEnumerable<byte>;
            var sexpVec = values as SymbolicExpression;

            if (sexpVec != null && sexpVec.IsVector())
                return sexpVec;
            if (ints != null)
                return engine.CreateIntegerVector(ints);
            if (chars != null)
                return engine.CreateCharacterVector(chars);
            if (cplxs != null)
                return engine.CreateComplexVector(cplxs);
            if (logicals != null)
                return engine.CreateLogicalVector(logicals);
            if (nums != null)
                return engine.CreateNumericVector(nums);
            if (raws != null)
                return engine.CreateRawVector(raws);
            throw new NotSupportedException(string.Format("Cannot convert type {0} to an R vector", values.GetType()));
        }
開發者ID:tjaskula,項目名稱:rdotnet,代碼行數:27,代碼來源:REngineExtension.cs


注:本文中的RDotNet.REngine.CreateCharacterVector方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。