Created
November 26, 2013 07:38
-
-
Save nassimhaddad/7654680 to your computer and use it in GitHub Desktop.
launch and kill R process from R
This file contains 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
# getting process id so we can kill it | |
pid <- system( "Rscript sample.R 500 > test2.txt & | |
echo $!", intern = TRUE) | |
system(paste(sprintf("kill %s", pid))) |
This file contains 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
options(echo=FALSE) | |
args <- commandArgs(trailingOnly = TRUE) | |
maxIter <- args[1] | |
for (i in 1:maxIter){ | |
Sys.sleep(0.1) | |
cat(i) | |
cat("\n") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment