I used R.NET to perform Change Point Detection as following
REngine.SetEnvironmentVariables();
REngine engine = REngine.GetInstance();
double[] data = new double[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
NumericVector vector = engine.CreateNumericVector(data);
engine.Evaluate("library(changepoint)");
engine.SetSymbol("values", vector);
engine.Evaluate("values.ts = ts(values, frequency = 12, start = c(2017, 1))");
engine.Evaluate("chpoints = cpt.mean(values.ts, method=\"BinSeg\")");
var result = engine.GetSymbol("chpoints");
engine.Dispose();
The Type of result
is shown as RDotNet.SymbolicExpression
and class
of chpoints
on RGui
is shown as cpt
> class(chpoints)
[1] "cpt"
attr(,"package")
[1] "changepoint"
I need to get the result back in C# to print values, to draw a graph, to identify what change points have been identified, etc. Any suggestions please.