Restart R within Rstudio

后端 未结 4 1001
感情败类
感情败类 2020-12-13 08:56

I\'m trying to call a simple python script from within R using system2(). I\'ve read some information I found vague that said if \'too much\' memory is used, it won\'t work.

相关标签:
4条回答
  • 2020-12-13 09:38

    RStudio has this undocumented rs.restartR() which is supposed to do just that: restarting R.

    However, it does not unload the packages that were loaded, nor does it clean the environment, so that I have some doubts about if it restarts R at all.

    0 讨论(0)
  • 2020-12-13 09:40

    Have you tried embedding the function call within the apply function, rather than a for loop?

    I've had some pieces of code that ran the system out of memory in a for loop run perfectly with apply. It might help?

    0 讨论(0)
  • 2020-12-13 09:52

    In Rstudio, you can restart the R session by:

    command/ctrl + shift + F10 
    

    You can also use:

    .rs.restartR()
    
    0 讨论(0)
  • 2020-12-13 09:55

    If you use RStudio, use the menu item Session > Restart R or the associated keyboard shortcut Ctrl+Shift+F10 (Windows and Linux) or Command+Shift+F10 (Mac OS). Additional keyboard shortcuts make it easy to restart development where you left off, i.e. to say “re-run all the code up to HERE”:

    In an R script, use Ctrl+Alt+B (Windows and Linux) or Command+Option+B (Mac OS) In R markdown, use Ctrl+Alt+P (Windows and Linux) or Command+Option+P (Mac OS) If you run R from the shell, use Ctrl+D or q() to quit, then restart R.

    0 讨论(0)
提交回复
热议问题