2

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?

Dinoop Nair
  • 2,483
  • 6
  • 28
  • 50

1 Answers1

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
  • 7
    For 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