From ernest.turro at ic.ac.uk  Tue Mar 20 20:02:51 2007
From: ernest.turro at ic.ac.uk (Ernest Turro)
Date: Tue, 20 Mar 2007 19:02:51 +0000
Subject: [Rd] Carriage returns and Sweave output
In-Reply-To: <40e66e0b0703200624o2e4e2f36v7a65a7583f866d80@mail.gmail.com>
References: <30B148B0-0C89-49BA-AEC9-160A6BA72D56@ic.ac.uk>
	<45FEA2FB.7030105@ebi.ac.uk>
	<DC49D83C-7739-4CEA-A837-0200D658BED7@ic.ac.uk>
	<45FEAE58.4030208@ebi.ac.uk>
	<17919.37635.203919.143033@stat.math.ethz.ch>
	<E8DDD4AC-6B1B-449E-A805-E99B52EAA498@ic.ac.uk>
	<40e66e0b0703200624o2e4e2f36v7a65a7583f866d80@mail.gmail.com>
Message-ID: <E4A0E9A7-E9CA-46E1-B5D3-D7CCB4C53A6F@ic.ac.uk>


On 20 Mar 2007, at 13:24, Douglas Bates wrote:

> [snip]

> In cases like this capture.output() is your friend.  Write one code
> chunk with results=hide,echo=FALSE that uses capture.output to trap
> the desired output as character strings then use string manipulation
> functions to do the desired replacement.  A second code chunk with
> eval=FALSE shows the code that apparently produces the output and a
> third code chunk with echo=FALSE uses cat on the manipulated character
> strings with quote=FALSE to show what apparently was produced.

That is extremely helpful. Thanks very much Douglas.

Ernest


>
>> >>>> Ernest Turro wrote:
>> >>>>> Dear all,
>> >>>>> I have a code chunk in my Rnw file that, when executed, outputs
>> >>>>> carriage return characters ('\r') to inform on the progress  
>> (e.g.
>> >>>>> "sweep 4 of 1024\r"). But Sweave interprets this as a newline
>> >>>>> character, and therefore I get countless pages of output in my
>> >>>>> vignette where I only really want one line. Any ideas?
>> >>>>> Thanks
>> >>>>> E
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>



[Rd] Carriage returns and Sweave output
Ernest Turro