/// <summary> /// Executes command line for any R binary with arguments /// </summary> public static RCommand ExecuteAsync(string executable, string arguments, IActionLog log, string rBasePath) { RCommand command = new RCommand(log); command.SendCommandAsync(rBasePath, executable, arguments); return(command); }
public static bool IsInstalled(string packageName, int msTimeout, string rBasePath) { string expression = "installed.packages()"; IActionLinesLog log = new LinesLog(NullLogWriter.Instance); bool result = RCommand.ExecuteRExpression(expression, log, msTimeout, rBasePath); if (result) { // stdout is list of packages // abind "abind" "C:/Users/[USER_NAME]/Documents/R/win-library/3.2" "1.4-3" NA return(FindPackageName(packageName, log.Lines)); } return(false); }
/// <summary> /// Executes 'RScript --vanilla --slave -e' with the supplied expression /// </summary> /// <param name="msTimeout"></param> /// <returns>Standard output produced by RScript.exe</returns> public static bool ExecuteRExpression(string expression, IActionLog log, int msTimeout, string rBasePath) { RCommand command = ExecuteRExpressionAsync(expression, log, rBasePath); return(command.Task.Wait(msTimeout)); }
/// <summary> /// Asynchronously install one R packages with dependencies /// </summary> public static RCommand Install(string packageName, IActionLog log, string rBasePath) { return(RCommand.ExecuteAsync("INSTALL " + packageName, log, rBasePath)); }