本文整理匯總了C#中RDotNet.REngine.CreateLogicalVector方法的典型用法代碼示例。如果您正苦於以下問題:C# REngine.CreateLogicalVector方法的具體用法?C# REngine.CreateLogicalVector怎麽用?C# REngine.CreateLogicalVector使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類RDotNet.REngine
的用法示例。
在下文中一共展示了REngine.CreateLogicalVector方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreateLogicalVector
public static void CreateLogicalVector(REngine engine, int n, Stopwatch s)
{
int[] d = createIntegerArray(n, 256);
var b = Array.ConvertAll(d, v => v < 128);
s.Start();
var nvec = engine.CreateLogicalVector(b);
s.Stop();
}
示例2: 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()));
}