Ejemplo n.º 1
0
 private static void TestDataFrameInMemoryCreation(REngine engine)
 {
     IEnumerable[] columns;
     string[] columnNames;
     DataFrame df;
     createTestDataFrame(engine, out columns, out columnNames, out df);
     df = engine.CreateDataFrame(columns, columnNames: null);
     columns[1] = new int[] { 1, 2, 3, 4, 5, 6, 7 };
     try
     {
         df = engine.CreateDataFrame(columns, columnNames: null);
     }
     catch (Exception ex)
     {
         counter++;
         Console.WriteLine(string.Format("Caught an exception ({0})", counter));
         Console.WriteLine(ex.ToString());
     }
     Console.WriteLine("Recovered from evaluation exception?");
 }
Ejemplo n.º 2
0
        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];
        }
Ejemplo n.º 3
0
 private static void createTestDataFrame(REngine engine, out IEnumerable[] columns, out string[] columnNames, out DataFrame df)
 {
     columns = createTestDfColumns();
     columnNames = new[] { "Category", "No.", "Measure" };
     df = engine.CreateDataFrame(columns, columnNames: columnNames);
 }
Ejemplo n.º 4
0
 private static void createTestDataFrame(REngine engine, out IEnumerable[] columns, out string[] columnNames, out DataFrame df)
 {
     columns     = createTestDfColumns();
     columnNames = new[] { "Category", "No.", "Measure" };
     df          = engine.CreateDataFrame(columns, columnNames: columnNames);
 }