Guest User

Untitled

a guest
Jul 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. RGui myScript.r param1 param2
  2.  
  3. myProcess.StartInfo.FileName =Pathing.GetUNCPath( r_path) + "\Rscript";
  4. string script_path=Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).Parent.Parent.Parent.FullName.ToString();
  5. myProcess.StartInfo.Arguments = Pathing.GetUNCPath(script_path) + "\display.r " + data_path;
  6. myProcess.StartInfo.UseShellExecute = true;
  7. myProcess.Start();
  8. myProcess.WaitForExit();
  9.  
  10. Args <- commandArgs(trailingOnly=TRUE)
  11. if(length(Args)>0 &sum(grepl("-f",commandArgs()))==0) ){
  12. if(grepl("(?i).r$",Args[1])){
  13. File <- Args[1]
  14. Args <- Args[-1]
  15. tryCatch(source(File) , error=function(e) print(e) )
  16. }
  17. }
  18.  
  19. Rgui --args myscript.r arg1 arg2
  20. Rscript myscript.r arg1 arg2
  21. R --args myscript.r arg1 arg2
  22. R -f myscript.r --args arg1 arg2
  23.  
  24. #dumb script
  25. print(Args)
Add Comment
Please, Sign In to add comment