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 5,375 times
        
    2
            
            
         
    
    
        Dinoop Nair
        
- 2,663
- 6
- 31
- 51
- 
                    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.
        
- 187
- 2
- 12
 
    
    
        Ricardo Saporta
        
- 54,400
- 17
- 144
- 178
- 
                    8For 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