From maechler at stat.math.ethz.ch  Mon Nov  3 09:19:31 2008
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Mon, 3 Nov 2008 09:19:31 +0100
Subject: [Rd] Wishlist: pass args from demo() to source()
In-Reply-To: <490DC501.1070404@stats.uwo.ca>
References: <971536df0811020633u13116fc0x50550cda3c1285b6@mail.gmail.com>
	<490DC501.1070404@stats.uwo.ca>
Message-ID: <18702.46099.86890.140314@stat.math.ethz.ch>

>>>>> "DM" == Duncan Murdoch <murdoch at stats.uwo.ca>
>>>>>     on Sun, 02 Nov 2008 10:19:29 -0500 writes:

    DM> 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.

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

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

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

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

No, I don't remember.  The change in December 1998 you mention
contained more important things than s/10000/250/.

In the mean time, we have  example()  calling 
  source(..., max.deparse.length = Inf, ....)

and I think we should do the same for demo().
"Arbitrary limits" is against the GNU coding standards.

Martin

    DM> 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

    DM> ______________________________________________
    DM> R-devel at r-project.org mailing list
    DM> https://stat.ethz.ch/mailman/listinfo/r-devel



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