usage examples

A.J. Rossini rossini at blindglobe.net
Thu Nov 6 03:25:57 CET 2003


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.html
> #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 attachme...{{dropped}}




More information about the ESS-help mailing list