From deepayan.sarkar at gmail.com  Fri Dec 22 19:16:38 2006
From: deepayan.sarkar at gmail.com (Deepayan Sarkar)
Date: Fri, 22 Dec 2006 10:16:38 -0800
Subject: [Rd] apropos changes in r-devel: intended feature or bug?
In-Reply-To: <17803.37850.646209.904350@stat.math.ethz.ch>
References: <eb555e660612212207q761861a1r7e95b7bdc3a8b6eb@mail.gmail.com>
	<17803.37850.646209.904350@stat.math.ethz.ch>
Message-ID: <eb555e660612221016k1884b47ey30d527e56cd749cd@mail.gmail.com>

On 12/22/06, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
> >>>>> "DeepS" == Deepayan Sarkar <deepayan.sarkar at gmail.com>
> >>>>>     on Thu, 21 Dec 2006 22:07:27 -0800 writes:
>
>     DeepS> The old apropos started with: if
>     DeepS> (!is.character(what)) what <-
>     DeepS> as.character(substitute(what))
>
>     DeepS> The new one has:
>
>     DeepS>    if (character.only) stopifnot(is.character(what))
>     DeepS>    else what <- as.character(substitute(what))
>
>     DeepS> i.e., the check for is.character(what) is
>     DeepS> missing. This has the effect that 'what' can no
>     DeepS> longer be a character string generated by a function
>     DeepS> call unless 'character.only = TRUE'. I don't think
>     DeepS> this was intended; the change makes previously valid
>     DeepS> use invalid and I can't think of a situation where it
>     DeepS> is useful.
>
> [ Did you read the corresponding NEWS entry? ]

Yes, but I didn't connect all the dots. Anyway, I'm happy with either
option (my usage will have to modified anyway).

While we're on the topic of apropos, here's another question:it seems
that determining the mode of an object requires it to be loaded (and
evaluated), at least with the current 'exists' implementation. This
means that whenever 'mode' is not "any", all matching symbols are
loaded. So, something as innocuous looking as

apropos(".", mode = "logical")

will load every lazy-loaded symbol visible, even though very few
things match the mode:

[This is an older r-devel, 2006-11-29 r40062]

> system.time(print(apropos(".", mode = "logical")))
[1] ".noGenerics" "F"           ".noGenerics" "T"
   user  system elapsed
  0.640   0.008   0.648

## after loading a huge annotation package

> library(hgu133plus2)
> system.time(print(apropos(".", mode = "logical")))
[1] ".noGenerics" "F"           ".noGenerics" "T"
   user  system elapsed
 63.112   0.980  64.815

## repeating (now everything is loaded)

> system.time(print(apropos(".", mode = "logical")))
[1] ".noGenerics" "F"           ".noGenerics" "T"
   user  system elapsed
  0.144   0.000   0.143

Is there any hope of avoiding this loading? If not, it might be
helpful to put a note in one of the help pages.

-Deepayan



[Rd] apropos changes in r-devel: intended feature or bug?
Deepayan Sarkar