exécuter script R depuis C#
Salut, je veux lancer un script R depuis C# lorsqu'un fichier est modifié. J'ai écrit le suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void fileSystemWatcher1_Changed(object sender, System.IO.FileSystemEventArgs e)
{
// Pour vérifier que la modification du fichier est détectée
MessageBox.Show(string.Format("Changed: {0} {1}", e.FullPath, e.ChangeType));
// Et on lance le script R
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "C:/Program Files/R/R-2.12.0/bin/Rscript.exe";
proc.StartInfo.WorkingDirectory = "C:/Program Files/R/R-2.12.0/bin/";
proc.StartInfo.Arguments = "source('C:/chemincodeR/codeR.R')";
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.RedirectStandardOutput = false;
proc.Start();
}
}
} |
mais ça ne marche pas, est-ce que vous pouvez m'aider ?