Last active
August 29, 2015 13:59
-
-
Save drewhendrickson/10690861 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ``` | |
| $ Rscript --vanilla R/myscript.R 12 &> logs/myscript.log & | |
| ``` | |
| Rscript runs the .R file as a standalone script, without going into the R environment. | |
| The –vanilla flag means that you run the script without calling in your .Rprofile | |
| (which is typically set up for interactive use) and without prompting you to save a workspace image. | |
| I always run the Rscript from the save level to that which is set as the project root for Rstudio | |
| to avoid any problems because of relative paths being set up wrongly. | |
| The number after the .R file to be run is the number of cores you want to run the parallel stuff on. | |
| Other arguments you may want to pass to R would also go here. | |
| the &> operator redirects both the stdin and stderror to the file logs/myscript.log | |
| (I always set up a logs directory in my R projects for this purpose). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment