Running multiple R scripts/sessions
I have a big looping script running in R-GUI and was curious if I can concurrently run other scripts in the same R-GUI session or can I ope开发者_StackOverflown another session of R? Any suggestions would be great thanks.
I often have several different instances of R running on my computer on different projects. While one is processing a script or doing a long run I can use a different one to work on another project.
While it is possible to have the same R session running multiple things concurrently (I have done this using the tcltk package) it is generally not advisable as the different projects could all access/change the same global environment which could mess things up. With multiple sessions they each have their own global environment (just be careful that they don't overwrite files if working from the same folder/directory).
There are also packages that will help with parallel processing which may be more what you are interested in. If each step of your loop runs independent of the others (step i+1 does not depend on the results of step i) and you have multiple processors (or multiple computers) then sometimes the parallel processing can help. See the HighPerformanceComputing task view on CRAN for descriptions of these packages.
精彩评论