[ESS] Prevent ESS From Writing .Rhistory

Kevin Coombes kevin.r.coombes at gmail.com
Tue Aug 23 18:44:42 CEST 2016


My question: Is it possible to prevent ESS from saving a ".Rhistory" file?

While I know this question has appeared in ess-help before (in September 
2009), I'd like to resurrect it.  Briefly, the previous discussion 
pointed out that running R from the command line with
     R --no-save
will prevent R itself from even asking about writing a workspace 
".RData" file, and will prevent it from creating a .Rhistory file. 
However, using
     (setq inferior-R-args "--no-save")
prevents the RData file but *not* the Rhistory file. The explanation had 
something to do with the (comint-write-input-ring).

I'd like to request that the behavior be changed, by explaining the 
use-case that got me to this point.

The application is that I am the "honest broker" who holds the keys to 
update a clinical data file. That is, I have a password-protected Excel 
file that contains the keys mapping between HIPPA-safe identifiers (like 
Sample013) to the protected health information of either the medical 
record number or patient name. Then there is a second password-protected 
Excel file that contains the updated clinical information using unsafe 
identifiers. I have to open both files, put the HIPAA-safe identifiers 
on the updated clinical information, remove the protected information, 
and write the results.

For obvious reasons, I don't want to hard-code the password into the 
R-script running in ESS.  So, I use the following lines to get the password

cat("Password? ")
pwd <- readLines(file("stdin"), 1)

and go merrily on my way, reading the data, deleting traces that might 
have existed in temporary files, and all should be good.

But it isn't.  Because ESS saves the .Rhistory file at the end, AND the 
.Rhistory file contains the password that I typed. So now there is a 
record of the password in a file left on my machine, and I have to 
manually track down that file and delete it.

Oh, and I'd like a solution that works by using a local file variable to 
set inferior-R-args (or something similar) in the script so that it 
automatically prevents the history file from being written.

So, is my use case strong enough to inspire someone to figure out if the 
current behavior of ESS can be modified? I would be very happy to help 
test things....


This email has been checked for viruses by Avast antivirus software.

More information about the ESS-help mailing list