[R] Sweave and abbreviating output from R

From: Gavin Simpson <gavin.simpson_at_ucl.ac.uk>
Date: Mon 11 Apr 2005 - 21:22:38 EST

Dear List,

I'm using Sweave to produce a series of class handouts for a course I am running. The students in previous years have commented about wanting output within the handouts so they can see what to expect the output to look like. So Sweave is a godsend for producing this type of handout - with one exception: Is there a way to suppress some rows of printed output so as to save space in the printed documentation? E.g


produces about 20 lines of output (depending on options("width")). I'd prefer something like:


[1] 0.527739021 0.185551107 -1.239195562 0.020991608 -1.225632520
[6] -1.000243373 -0.020180393 2.552180776 -1.719061533 -0.195024625

[96] -0.744916379 0.863733400 -0.186667848 1.378236663 -0.499201046

The actual application would be printing of output from summary() methods. Ideally it would be nice to ask for line 1-10, 30-40, 100-102, for example, so you could print the first few lines of several sections of output. I'd like to automate this so I don't need to keep copying and pasting into the final tex source or forget to do it if I alter some previous part of the Sweave source.

Has anyone tried to do this? Does anyone know of an automatic way of achieving the simple abbreviation or the more complicated version I described?

Any thoughts on this?

Thanks in advance,


Gavin Simpson                     [T] +44 (0)20 7679 5522
ENSIS Research Fellow             [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC                 [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography       [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way                    [W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Mon Apr 11 21:36:36 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:06 EST