本文整理匯總了C#中RDotNet.REngine.Initialize方法的典型用法代碼示例。如果您正苦於以下問題:C# REngine.Initialize方法的具體用法?C# REngine.Initialize怎麽用?C# REngine.Initialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類RDotNet.REngine
的用法示例。
在下文中一共展示了REngine.Initialize方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: frmData
public frmData()
{
InitializeComponent();
// There are several options to initialize thengine, but by default the following suffice:
engine = REngine.GetInstance();
engine.Initialize();
}
示例2: CodeController
public CodeController()
{
if (_engine != null) return;
_engine = REngine.GetInstance(null, true, null, CharacterDevice);
_engine.Initialize();
_engine. .Install(GraphicsDevice);
}
示例3: Form1
public Form1()
{
InitializeComponent();
this.FormClosed += new FormClosedEventHandler(OnFormClosed);
REngine.SetEnvironmentVariables();
engine = REngine.GetInstance();
// REngine requires explicit initialization.
// You can set some parameters.
engine.Initialize();
}
示例4: InitializeRDotNet
internal static void InitializeRDotNet()
{
try
{
REngine.SetEnvironmentVariables();
_engine = REngine.GetInstance();
_engine.Initialize();
}
catch (Exception ex)
{
LogDisplay.WriteLine("Error initializing RDotNet: " + ex.Message);
}
}
示例5: GetInstance
/// <summary>
/// Gets a reference to the R engine, creating and initializing it if necessary. In most cases users need not provide any parameter to this method.
/// </summary>
/// <param name="dll">The file name of the library to load, e.g. "R.dll" for Windows. You usually do not need need to provide this optional parameter</param>
/// <param name="initialize">Initialize the R engine after its creation. Default is true</param>
/// <param name="parameter">If 'initialize' is 'true', you can optionally specify the specific startup parameters for the R native engine</param>
/// <param name="device">If 'initialize' is 'true', you can optionally specify a character device for the R engine to use</param>
/// <returns>The engine.</returns>
/// <example>
/// <p>A minimalist approach is to just call GetInstance</p>
/// <code>
/// REngine.SetEnvironmentVariables();
/// var engine = REngine.GetInstance();
/// engine.Evaluate("letters[1:26]");
/// </code>
/// <p>In unusual circumstances you may need to elaborate on the initialization in a separate method call</p>
/// <code>
/// REngine.SetEnvironmentVariables([email protected]"c:\my\peculiar\path\to\R\bin\x64");
/// var engine = REngine.GetInstance(initialize=false);
/// StartupParameter sParams=new StartupParameter(){NoRenviron=true;};
/// ICharacterDevice device = new YourCustomDevice();
/// engine.Initialize(parameter: sParams, device: device);
/// engine.Evaluate("letters[1:26]");
/// </code>
/// </example>
public static REngine GetInstance(string dll = null, bool initialize = true, StartupParameter parameter = null, ICharacterDevice device = null)
{
if (!environmentIsSet) // should there be a warning? and how?
SetEnvironmentVariables();
if (engine == null)
{
engine = CreateInstance(EngineName, dll);
if (initialize)
engine.Initialize(parameter, device);
}
if (engine.Disposed)
throw new InvalidOperationException("The single REngine instance has already been disposed of (i.e. shut down). Multiple engine restart is not possible.");
return engine;
}
示例6: InitializeRDotNet
private void InitializeRDotNet()
{
REngine.SetEnvironmentVariables();
engine = REngine.GetInstance();
// REngine requires explicit initialization.
// You can set some parameters.
engine.Initialize();
//load BSky and R packages
engine.Evaluate("library(uadatapackage)");
engine.Evaluate("library(foreign)");
engine.Evaluate("library(data.table)");
engine.Evaluate("library(RODBC)");
engine.Evaluate("library(car)");
engine.Evaluate("library(aplpack)");
engine.Evaluate("library(mgcv)");
engine.Evaluate("library(rgl)");
engine.Evaluate("library(gmodels)");
}
示例7: InitiateR
private static void InitiateR()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
form1 = new Form1();
string rhome = System.Environment.GetEnvironmentVariable("R_HOME");
if (string.IsNullOrEmpty(rhome))
rhome = @"C:\Program Files\R\R-3.1.1";
System.Environment.SetEnvironmentVariable("R_HOME", rhome);
System.Environment.SetEnvironmentVariable("PATH", System.Environment.GetEnvironmentVariable("PATH") + ";" + rhome + @"\bin\i386");
REngine.SetEnvironmentVariables();
// There are several options to initialize the engine, but by default the following suffice:
engine = REngine.GetInstance();
engine.Initialize();
}
示例8: MakeEngine
private static void MakeEngine()
{
if (_engine == null)
{
REngine.SetEnvironmentVariables();
_engine = REngine.GetInstance();
_engine.Initialize();
}
}
示例9: TextMiningApi
public TextMiningApi()
{
REngine.SetEnvironmentVariables();
_engine = REngine.GetInstance();
_engine.Initialize();
}
示例10: InitializeR
private void InitializeR()
{
engine = REngine.GetInstance();
engine.Initialize();
var currentDir = System.Environment.CurrentDirectory.Replace('\\', '/');
if (!m_JADE_Loaded)
{
engine.Evaluate("install.packages('JADE', repos='http://cran.us.r-project.org')");
//repos ='https://cran.rstudio.com/bin/windows/contrib/3.2/JADE_1.9-93.zip')");
engine.Evaluate("library('JADE')");
m_JADE_Loaded = true;
}
}