Tuesday, August 9, 2016

Integrated R.Net within your ASP.Net MVC applicaiton

R is a programming language used for statistical computing. For business intelligence, R is very useful for prediction marketing. To better integrating R into Microsoft .Net system, there is one tool named R.Net. You can use NuGet to install R.Net to your .net project. The latest version of R.Net is 1.6.5. You can use the following command to install the latest R.Net:
Install-Package R.NET.Community
Note R.Net didn't set the environment variable correctly. So the first issue you suffered for R.Net would be package installation.
REngine r = REngine.GetInstance();
r.Evaluate("library(RODBC)");
An unhandled exception of type 'RDotNet.EvaluationException' occurred in RDotNet.dll
Additional information: Error: package or namespace load failed for 'RODBC'
This is happened because R.net can't find r.dll as the Path doesn't included. To set the correct Path under windows 10, click on windows button, choose Settings, click on System, choose About from the left menu, scroll down to the bottom, click on System Info, choose Advanced System Setting from the left menu, choose the Tab of Advanced, click on Environment Variables button, then click on Edit button, click on New button, add following path:
C:\\Program Files\\R\\R-3.3.1\\bin\\i386
After this, restart windows 10, you should resolve this issue. Note other resources prefer to add more paths such as library, it's wrong!!! It will affect some packages installation.


Reference:
https://www.nuget.org/packages/R.NET.Community/
http://jmp75.github.io/rdotnet/ts_asp_dot_net/




4 comments:

  1. Can you please tell me how to do the r function sum() in a controller function in MVC?

    ReplyDelete
    Replies
    1. R.Net has lots of issues we don't use them any more. If you want to use R inside your Visual studio project, you better to use SQL Server 2016 with R.

      Delete
  2. Thank you for your guide to with upgrade information about Dot NET keep update at
    .NET Online Training Hyderabad

    ReplyDelete
  3. keep up the good work. this is an Assam post. this to helpful, i have reading here all post. i am impressed. thank you. this is our digital marketing training center.


    Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery


    ReplyDelete