本文整理匯總了C#中RDotNet.REngine.CreateDataFrame方法的典型用法代碼示例。如果您正苦於以下問題:C# REngine.CreateDataFrame方法的具體用法?C# REngine.CreateDataFrame怎麽用?C# REngine.CreateDataFrame使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類RDotNet.REngine
的用法示例。
在下文中一共展示了REngine.CreateDataFrame方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestDataFrameInMemoryCreation
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?");
}
示例2: createTestDataFrame
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);
}
示例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];
}