[ESS] New ESS user questions.

Erik Iverson eriki at ccbr.umn.edu
Mon Aug 9 21:16:22 CEST 2010


First thing I notice is in the documentation for ess-directory:
"The directory ESS is run from.  It must end in a slash."
So try adding that final "/" first...

My approach to your issue is the following:
1) define elisp function in .emacs for each project I work on.
  -- these launch shells, start R, start dired, open a default file, 
setup windows, etc.

2) These elisp functions call an R function found in my .Rprofile, 
specific to each project.
-- these function use setwd() to set the working directory in R, check 
if any new updates are available in the data directories, etc.

I have something like the following for each of my elisp functions:

(defun studyname ()
   (ess-execute "studyname()" 'buffer)


where studyname is whatever study I'm launched.

The advantage to this situation is that whatever I'm doing in emacs, I 
can simply do:

M-x studyname

and an appropriate R session, shell session, dired buffer, etc are all 
created and placed on the screen how I want them, and any relevant 
messages are waiting for me in the new R session (such as "Updated 
Transfer Available").

Hope this helps!

Alex Bokov wrote:
> I've just started using ESS and so far it's wonderful. The only problem 
> is session management. When I run R from a console, for each project I'm 
> working on I have a script for invoking one or more R sessions in 
> specific directories along with a text editor preset to open certain files.
> The part I can't figure out is how to specify what the R working 
> directory should be. I tried to set the default directory and launch R 
> in my .emacs file as follows...
> (setq ess-directory '"~/Documents/10_mydir")
> (R)
> ...iESS launches an R session just fine but no matter what I set the 
> directory to, R's working directory is always "~/Documents/". What am I 
> doing wrong?
> I suppose I could set the desired directory as an environment variable 
> or write it to a temporary file and then have my .Rprofile read it and 
> change directories accordingly, but that seems like reinventing the 
> wheel if Emacs can do it for me.
> Thanks.
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

More information about the ESS-help mailing list