[ESS] Prevent ESS From Writing .Rhistory

Enrico Schumann e@ @end|ng |rom enr|co@chum@nn@net
Tue Aug 23 20:45:33 CEST 2016


On Tue, 23 Aug 2016, Kevin Coombes <kevin.r.coombes using gmail.com> writes:

> Hi,
>
> 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....
>
> Best,
>   Kevin
>
>

Hi Kevin,

does setting

  (setq-default inferior-R-args "--no-restore-history --no-save -q")
  (setq ess-history-file nil)

in your .emacs file help?

See also http://ess.r-project.org/Manual/ess.html#Saving-History .


Kind regards
     Enrico


-- 
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net




More information about the ESS-help mailing list