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,663
  • 6
  • 31
  • 51

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.
  • 187
  • 2
  • 12
Ricardo Saporta
  • 54,400
  • 17
  • 144
  • 178
  • 8
    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