-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
work for documentation of next R.NET release (1.6)
- Loading branch information
Showing
16 changed files
with
110 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="R.NET" version="1.5.6" targetFramework="net45" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
using System; | ||
using RDotNet; | ||
using RDotNetSetup; | ||
using System.Linq; | ||
|
||
namespace Optimization | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="R.NET" version="1.5.6" targetFramework="net40" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,37 @@ | ||
using RDotNet; | ||
using RDotNetSetup; | ||
using System; | ||
using System.Collections.Generic; | ||
using System; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using RDotNet; | ||
|
||
namespace Sample1 | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
SetupHelper.SetupPath(); | ||
using (REngine engine = REngine.CreateInstance("RDotNet")) | ||
{ | ||
// From v1.5, REngine requires explicit initialization. | ||
// You can set some parameters. | ||
engine.Initialize(); | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
REngine.SetEnvironmentVariables(); | ||
REngine engine = REngine.GetInstance(); | ||
// REngine requires explicit initialization. | ||
// You can set some parameters. | ||
engine.Initialize(); | ||
|
||
// .NET Framework array to R vector. | ||
NumericVector group1 = engine.CreateNumericVector(new double[] { 30.02, 29.99, 30.11, 29.97, 30.01, 29.99 }); | ||
engine.SetSymbol("group1", group1); | ||
// Direct parsing from R script. | ||
NumericVector group2 = engine.Evaluate("group2 <- c(29.89, 29.93, 29.72, 29.98, 30.02, 29.98)").AsNumeric(); | ||
// .NET Framework array to R vector. | ||
NumericVector group1 = engine.CreateNumericVector(new double[] { 30.02, 29.99, 30.11, 29.97, 30.01, 29.99 }); | ||
engine.SetSymbol("group1", group1); | ||
// Direct parsing from R script. | ||
NumericVector group2 = engine.Evaluate("group2 <- c(29.89, 29.93, 29.72, 29.98, 30.02, 29.98)").AsNumeric(); | ||
|
||
// Test difference of mean and get the P-value. | ||
GenericVector testResult = engine.Evaluate("t.test(group1, group2)").AsList(); | ||
double p = testResult["p.value"].AsNumeric().First(); | ||
// Test difference of mean and get the P-value. | ||
GenericVector testResult = engine.Evaluate("t.test(group1, group2)").AsList(); | ||
double p = testResult["p.value"].AsNumeric().First(); | ||
|
||
Console.WriteLine("Group1: [{0}]", string.Join(", ", group1)); | ||
Console.WriteLine("Group2: [{0}]", string.Join(", ", group2)); | ||
Console.WriteLine("P-value = {0:0.000}", p); | ||
} | ||
} | ||
} | ||
Console.WriteLine("Group1: [{0}]", string.Join(", ", group1)); | ||
Console.WriteLine("Group2: [{0}]", string.Join(", ", group2)); | ||
Console.WriteLine("P-value = {0:0.000}", p); | ||
|
||
// you should always dispose of the REngine properly. | ||
// After disposing of the engine, you cannot reinitialize nor reuse it | ||
engine.Dispose(); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="R.NET" version="1.5.6" targetFramework="net45" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="R.NET" version="1.5.6" targetFramework="net45" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="R.NET" version="1.5.6" targetFramework="net45" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters