Is there any R code to restart the rsession? I am usually doing this by pressing cntrl+shift+0.
But now want to do this in my code. how can i do this?
Asked
Active
Viewed 4,614 times
2
Dinoop Nair
- 2,483
- 6
- 28
- 50
-
The correct way is to do: invisible(.rs.restartR()) – MarcG Jul 09 '21 at 08:54
1 Answers
1
Depending on what you are actually trying to accomplish, you may simply want something like
rm(list=ls())
Note: be careful this code actually delete your entire work/variable/data
Firhat Nawfan H.
- 177
- 2
- 12
Ricardo Saporta
- 52,793
- 14
- 136
- 168
-
7For the record, this is quite different from restarting an R session. Following this answer, packages are not unloaded, variables whose names start with `.` are not deleted, any mutable state of packages is not reset, and any startup scripts are not rerun. – drhagen Aug 02 '16 at 18:15