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

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Fri 22 Dec 2006 - 18:16:38 GMT

On 12/22/06, Martin Maechler <maechler@stat.math.ethz.ch> wrote:
> >>>>> "DeepS" == Deepayan Sarkar <deepayan.sarkar@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



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat Dec 23 05:19:37 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 22 Dec 2006 - 18:31:04 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.