usage examples - summary

Vadim Ogranovich vograno at sbcglobal.net
Thu Nov 6 05:55:34 CET 2003


Hi,

A couple of days ago I posted a question regarding the process of using
ESS for "ad hoc exploratory analysis". The emphasis was on "ad hoc".
There were three suggestions:
* use command history.
This is supported by ESS however it doesn't answer the question how to
annotate your session
* Use Sweave
This is geared towards writing papers and generating reproducible
results. Not sure how well it suits ad hoc analysis.
* A.Rossini: Use .R file for your code, .Rt for session transcripts, see
Tony's message below for details.
This is close to what I need, but I think it still involves too much of
file juggling.


After playing with it a little bit I think I want to stick to a single
diary that runs through multiple sessions, i.e. a new session transcript
follows that of the previous one in the same file. There are two missing
(?) features that would greatly facilitate this:
* a function that starts R in the current buffer (as opposed to the *R*
buffer). This way I can C-c C-f my diary.Rt and start R in the buffer
* ess-evaluate-region should discard all command outputs that are
present in the region. This way I can evaluate a portion of my
transcript as is, whereas now I need to do it one command at a time. Of
course, I could use ess-transcript-clean-region, execute the region, and
then undo the clean. But there should probably be a better way.

Speaking of ess-transcript-clean-region, I think it should preserve the
comments and not strip them out. This way the comment you put in the
transcript will find its way into the clean program you build off it.


Hope this make sense.

Thank you for all of your suggestions,
Vadim


P.S. You are welcome to discuss it with me further, just remember that I
am not subscribed to the list, so please use my private e-mail.


> -----Original Message-----
> From: A.J. Rossini [mailto:rossini at blindglobe.net] 
> Sent: Wednesday, November 05, 2003 6:26 PM
> To: vograno at yahoo.com
> Cc: ess-help at stat.math.ethz.ch
> Subject: Re: usage examples
> 
> 
> 
> I havn't seen any replies, but there are a few things that 
> might help.  As far as linked from the WWW site, there is the 
> tech report and my lab session from a course I taught in 
> Copenhagen DK last
> month.   The lab session (#1) describes a possible scenario that I
> commonly use for data analysis (using a toy session).
> 
> Some comments below.
> 
> "Vadim Ogranovich" <vograno at sbcglobal.net> writes:
> 
> > Hi,
> >  
> > I am trying to figure out how I can use ESS to keep a "diary" of my 
> > data analysis. The ESS help discusses some usage scenarios 
> under the 
> > following heading
> >
> >  
> > 
> <http://www.analytics.washington.edu/downloads/ess/doc/html/ess_toc.ht
> > ml
> > #TOC23> Scenarios for use (possibilities--based on actual usage)
> >
> > 1:  ##    Data Analysis Example (source code is real)
> >
> >  
> >  
> > It suggest using of two files, the source file myfile.R and the 
> > transcript file myfile.Rt. In short you are supposed to start with 
> > myfile.R and then capture the results in the transcript 
> myfile.Rt. But 
> > it is not clear how to continue the analysis the next day when you 
> > have both myfile.R and the transcript myfile.Rt. For 
> example, do you 
> > save the new session in a new transcript file myfile2.Rt or 
> you append 
> > it to the existing transcript, etc?
> >  
> > So here are some questions that I have:
> > Could someone please give at least a toy multi-session example of 
> > using myfile.R and myfile.Rt?
> 
> You don't need the transcript unless you want to save a log 
> of the actual interaction.
> 
> > Do I need the .R file if I don't write my own functions?
> 
> Sure!  I almost always work out of the *.R file, editing the 
> commands as I go, keeping the ones I like.
> 
> 
> > Is it a possible/advisable to run R in the .Rt buffer?
> 
> Not necessarily.
> 
> > When I open .Rt file in Emacs the buffer comes out 
> non-editable, why?
> 
> So you don't destroy your transcript by accident.
> 
> 
> > To narrow down the scope of my questions let me describe 
> how I use R. 
> > Normally I prepare one or more datasets using R or Perl scripts and 
> > then I analyze the datasets in a number of interactive sessions 
> > interactively in the *R* buffer. I rarely write new 
> functions during 
> > the interactive sessions, it is more like an ad hoc 
> querying. Now what 
> > I want is to keep logs of these interactive sessions as a single 
> > running-through diary, which is not necessarily very 
> self-consistent. 
> > I should be able to put comments to both the commands and their 
> > outputs ("here we compute the auto-correlations" is a 
> comment to the 
> > command, "note strong second lag correlation" is a comment to its 
> > output). I want be able to re-execute parts of the commands in the 
> > diary. I sometimes want to merge the new results with the old ones 
> > _preserving_ the comments...
> 
> So, one way is simply to create the script the way you want, 
> editing and commenting the *.R file and evaluating lines, 
> paragraphs, regions, or the whole buffer as needed.
> 
> Evaluate for the final results, and a final "verifiable" transcript.
> 
> There are other approaches, including embedding within a 
> LaTeX document and using Sweave -- my course notes have a 
> simple example of that, along with a makefile which automates 
> the process (i.e. "press the compile button to build").
> 
> best,
> -tony
> 
> -- 
> rossini at u.washington.edu            
> http://www.analytics.washington.edu/ 
> Biomedical and Health 
> Informatics   University of Washington
> Biostatistics, SCHARP/HVTN          Fred Hutchinson Cancer 
> Research Center
> UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is 
> unreliable FHCRC  (M/W): 206-667-7025 FAX=206-667-4812 | use Email
> 
> CONFIDENTIALITY NOTICE: This e-mail message and any 
> attachments may be confidential and privileged. If you 
> received this message in error, please destroy it and notify 
> the sender. Thank you.
>




More information about the ESS-help mailing list