Where is the physical location of user defined .GlobalEnv variables in R and how to delete them permanently?

360 Views Asked by At

Problem: I needed to use Matlab within R. Then I added relevant package R.matlab. I defined variables in a demo example of working with Matlab within R.

The defined variables are: data, path, pathname, x, y The contents of the variables are:

>path
[1] "C:/Revolution/R-Enterprise-7.1/R-3.0.2/library/R.matlab/mat-files"  
>pathname
[1] "C:/Revolution/R-Enterprise-7.1/R-3.0.2/library/R.matlab/mat-files/ABC.mat"  
>data
$A      [,1] [,2] [,3]
 [1,]    1   10   19
....................
 [9,]    9   18   27
$B      [,1]
[1,]    1
..........
[10,]   10

$C
, , 1
[,1] [,2] [,3]
[1,]    1    3    5
[2,]    2    4    6
.......................
, , 3
     [,1] [,2] [,3]
[1,]   13   15   17
[2,]   14   16   18

attr(,"header")
attr(,"header")$description
[1] "MATLAB 5.0 MAT-file, Platform: windows, Software: R v2.15.0, Created on: Sat Mar     31 19:50:00 2012"
attr(,"header")$version
[1] "5"
attr(,"header")$endian
[1] "little"

What I needed is: to obtain a clear R session (no variables/objects in Object Browser) whenever I restart Revolution R. Currently, whenever I restart Revolution R, the above variables (data, path, pathname, x, y) appear in Object Browser.

What I did till now:

  1. I completely deleted R.Matlab folder from my default library location: C:\Revolution\R-Enterprise-7.1\R-3.0.2\library

  2. remove.packages("R.matlab")

  3. Closed Revolution R; Deleted the existing solution file (.sln) in current R working directory; and restarted Revolution R.

Whatever I do, I could not solve: whenever I close Revolution R and restart it, the variables (data, path, pathname, x, y) appear in .GlobalEnv in object browser. I want clear .GlobalEnv when I start Revolution R.

2

There are 2 best solutions below

0
On BEST ANSWER

Solution (step by step):

1. Delete all objects (In Revolution R, from menu: Data - Remove all objects)

2. In Revolution R, from menu: tools - options - Revolution RPE Options - Automatically Restore Saved Objects(selected:False).

3. Close Revolution R, restart Revolution R

0
On

Try removing the .Rdata file in the working directory (use getwd() command if needed)? Some of these IDEs save the workspace to disk and load it back the next time you start them.