I have used Rscript runner but its not working.
public static string SetupPath(string Rversion = "R-3.2.3")
{
var oldPath = System.Environment.GetEnvironmentVariable("PATH");
var rPath = System.Environment.Is64BitProcess ?
string.Format(@"C:\Program Files\R\R-3.2.3\bin\x64", Rversion) :
string.Format(@"C:\Program Files\R\R-3.2.3\bin\i386", Rversion);
if (!Directory.Exists(rPath))
throw new DirectoryNotFoundException(
string.Format(" R.dll not found in : {0}", rPath));
var newPath = string.Format("{0}{1}{2}", rPath,
System.IO.Path.PathSeparator, oldPath);
System.Environment.SetEnvironmentVariable("PATH", newPath);
return newPath.ToString() ;
}
This Button1_Click method calls the rscript runner.
protected void Button1_Click(object sender, EventArgs e)
{
string s = SetupPath();
string args = "";
string r = @"D:\scr1.r";
var RcodeFilePath = string.Format(@"D:\scr1.r", "R-3.2.3");
//string c = RScriptRunner.RunFromCmd(RcodeFilePath, s);
string c = RScriptRunner.RunFromCmd(r, "rscript.exe");
Label1.Text = c;
}
Got the solution..!
I used "Shiny" a library in R. This converts the r script into an app which can then be called from asp.net using simple http request.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.