ngottlieb at marinercapital.com
2008-Jan-25 14:36 UTC
[R] Need Advice with C# Program to Create and Display Cusum Chart
I need to write a C# program to create and display Cusum chart from any of the packages, spc, qcc or strucchange. Issues: 1-The data resides in a MS SQL Database. The C# program will handle obtaining the data for the requisite types of samples. Assistance needed on: 1-How can I call the cusum capabilities of any of the above packages and pass the data to the cusum function and plot? 2-How can from the C# program, obtain the returned data and display the plotted chart in my C# program? 3- Displaying the chart in the C# program and allowing it to be saved is important. Goal is to make this all transparent to my end users. Each user will have their own instantiation of R on their PC. Any advice on best approach would be appreciated. I am looking at "Writing R Extensions" doc however a jump start or other References to doing this within the .net framework would be helpful. Thanks, Neil -------------------------------------------------------- This information is being sent at the recipient's reques...{{dropped:16}}
Dieter Menne
2008-Jan-25 18:39 UTC
[R] Need Advice with C# Program to Create and Display Cusum Chart
<ngottlieb <at> marinercapital.com> writes:> > I need to write a C# program to create and display Cusum chart from any > of the packages, > spc, qcc or strucchange. > > 1-The data resides in a MS SQL Database. The C# program will handle > obtaining the data for the requisite types of samples.It is easy to read SQL databases directly from R via RODBC. It's fast enough even for long time series I usually read in.> 1-How can I call the cusum capabilities of any of the above packages > and pass the data to the cusum function and plot?cumsum is such an easy beast, that I would not bother R when the data are read in from C(++,#,plain), and calculate it in compiled language instead.> 2-How can from the C# program, obtain the returned data > and display the plotted chart in my C# program?> 3- Displaying the chart in the C# program and allowing it to be saved is > important.Using .NET with R is not straightforward. You could use the DCOM interface which needs some time to get used to. You could also write a wrapper DLL in C that can be called. I have done this, but I only would do it again if on both sides I had functionality that is powerful enough not to be ported (or with inaccessible sources). My suggestion is: stay within R for reading and processing, export the charts to files and display these in C# applications that read the file. Maybe you could even use a browser for it. I have heard the argument "file is too slow" in that context: be sure, it isn't, and your programming life is over too soon to think in seconds. Or, do everything in C#. Plotting cumsum is probably not the feature where R is superior to other environments. Dieter