[Rd] Wishlist: pass args from demo() to source()

Duncan Murdoch murdoch at stats.uwo.ca
Sun Nov 2 16:19:29 CET 2008

On 02/11/2008 9:33 AM, Gabor Grothendieck wrote:
> Currently demo calls source with a hard coded max.deparse.length = 250
> so you can't really see the demo properly in some cases.  Note the
> [TRUNCATED] below.  (1) It would be nice if demo passed max.deparse.length
> (and other args to source).  (2) Also a larger max.deparse.length default would
> be nice to make it less likely one would have to set it in the first place.

I can see increasing the default, but it doesn't really seem like a good 
design to give extra args to demo().  Would users ever know about them?

So to me the choice would be to set a large max.deparse.length in the 
call to source() from demo().

Just for fun, I tracked down the revision where the 250 value was 
introduced:  it was in r3045 in December 1998 on 
where the max was decreased from 10000 to 250.  (The demo() function was 
in source.R in those days.)  And the 10000 was added in r354 in December 
1997 to https://svn.r-project.org/R/trunk/src/library/base/R/source, to 
remove the TRUNCATED message.

Martin, is there any chance you remember what problem the 10000 caused? 
  If those problems still exist, I'd add an arg to demo with 250 as the 
default, but if not, I'd say putting it back as 10000 would be reasonable.

Duncan Murdoch

>> R.version.string # Vista
> [1] "R version 2.8.0 Patched (2008-10-21 r46766)"
>> demo("gsubfn-si")
>         demo(gsubfn-si)
>         ---- ~~~~~~~~~
> Type  <Return>   to start :
>> # given number possibly followed by SI letter (e.g. 32.5k where k means 1000)
>> # replace letter with e followed by appropriate digits.
>> # (see formatEng2R by Hans-Joerg Bibiko in the R Wiki)
>> conv <- list(y = "e-24", z = "e-21", a = "e-18", f .... [TRUNCATED]
>> gsubfn(".$", conv, c("19", "32.5M"))
> [1] "19"     "32.5e6"
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

More information about the R-devel mailing list