2016-04-25 15 views
0

Rscriptランナーを使用しましたが動作しません。私はasp.netページからc#を使用してrスクリプトを実行しようとしていますが、実行されていません

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() ; 
     } 

このButton1_Clickメソッドは、rscriptランナーを呼び出します。

 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; 
      } 
+0

エラーが発生しますか? – Alexander

+0

エラーまたは例外が発生していません –

答えて

1

解決策が見つかりました。

Rで「Shiny」ライブラリを使用しました これはrスクリプトを単純なhttp要求を使ってasp.netから呼び出すことができるアプリケーションに変換します。

関連する問題