friedrich.leisch at stat.uni-muenchen.de
2007-Jan-11 14:42 UTC
[Rd] Wishlist: Sweave: allow line breaks after forward slashes (PR#9444)
>>>>> On Thu, 11 Jan 2007 15:07:00 +0100 (CET), >>>>> ahenningsen (a) wrote:> Full_Name: Arne Henningsen > Version: 2.4.0 > OS: Linux > Submission from: (NULL) (134.245.140.242) > Sweave does not allow line breaks after forward slashes ("/"). This might lead > to a long "substring" of a command that cannot be wrapped. Hence, Sweave either > keeps this long "substring" in the current line and produces a too long line or > it moves the entire "substring" in the following line and leaves the current > line rather empty. This problem can be solved if Sweave is allowed to introduce > line breaks after forward slashes. (I guess that this problem can also be solved > if parse() adds a blank after a forward slash.) > Example: > The following expression cannot be wrapped by Sweave: > mean(myDataframe$myFirstVariable)/mean(myDataframe$mySecondVariable) In R 2.5.0 you can use Sweave option keep.source=TRUE to keep the original formatting of source code, including all indentation and line breaks -> does this solve your problem? Best, Fritz Leisch
Arne Henningsen
2007-Jan-12 08:34 UTC
[Rd] Wishlist: Sweave: allow line breaks after forward slashes (PR#9444)
Dear Fritz and Duncan, thank you very much for your answers. On Thursday 11 January 2007 15:42, friedrich.leisch at stat.uni-muenchen.de wrote:> [...] > In R 2.5.0 you can use Sweave option keep.source=TRUE to keep the > original formatting of source code, including all indentation and line > breaks -> does this solve your problem?short answer: Yes. long answer: I generally like the formatting of the code chunks by Sweave (deparse). Therefore, I hesitate a bit to use "keep.source=TRUE". On Thursday 11 January 2007 15:56, murdoch at stats.uwo.ca wrote:> [...] > It's actually deparse() that causes this, but the problem is already > solved in R-devel (to become R 2.5.0).Great!> If you don't like the formatting > that deparse() gives to one of your expressions, use the Sweave option > keep.source=TRUE, and your original formatting will be kept for that > chunk. Or globally retain your formatting via > \SweaveOpts{keep.source=TRUE} at the start of your file.see above. Best wishes, Arne -- Arne Henningsen Department of Agricultural Economics University of Kiel Olshausenstr. 40 D-24098 Kiel (Germany) Tel: +49-431-880 4445 Fax: +49-431-880 1397 ahenningsen at agric-econ.uni-kiel.de http://www.uni-kiel.de/agrarpol/ahenningsen/
Duncan Murdoch
2007-Jan-12 10:39 UTC
[Rd] Wishlist: Sweave: allow line breaks after forward slashes (PR#9444)
On 1/12/2007 2:26 AM, Arne Henningsen wrote:> Dear Fritz and Duncan, > > thank you very much for your answers. > > On Thursday 11 January 2007 15:42, friedrich.leisch at stat.uni-muenchen.de > wrote: >> [...] >> In R 2.5.0 you can use Sweave option keep.source=TRUE to keep the >> original formatting of source code, including all indentation and line >> breaks -> does this solve your problem? > > short answer: Yes. > long answer: I generally like the formatting of the code chunks by Sweave > (deparse). Therefore, I hesitate a bit to use "keep.source=TRUE". > > On Thursday 11 January 2007 15:56, murdoch at stats.uwo.ca wrote: >> [...] >> It's actually deparse() that causes this, but the problem is already >> solved in R-devel (to become R 2.5.0). > > Great!I think you misunderstood me, given the "long answer". We haven't changed the way deparse() handles "/". The solution in R-devel is given below. Duncan Murdoch>> If you don't like the formatting >> that deparse() gives to one of your expressions, use the Sweave option >> keep.source=TRUE, and your original formatting will be kept for that >> chunk. Or globally retain your formatting via >> \SweaveOpts{keep.source=TRUE} at the start of your file. > > see above. > > Best wishes, > Arne >