From martin.morgan at roswellpark.org  Fri Dec  9 03:37:59 2016
From: martin.morgan at roswellpark.org (Martin Morgan)
Date: Thu, 8 Dec 2016 21:37:59 -0500
Subject: [Rd] methods(`|`) lists all functions?
In-Reply-To: <20161208221610.GJ6368@ofb.net>
References: <20161208221610.GJ6368@ofb.net>
Message-ID: <5d9ae4e0-85d1-daa4-a57e-0c5e6681ae12@roswellpark.org>

On 12/08/2016 05:16 PM, frederik at ofb.net wrote:
> Dear R-Devel,
>
> I was attempting an exercise in Hadley Wickam's book "Advanced R". The
> exercise is to find the generic with the greatest number of methods.
>
> I found that 'methods(`|`)' produces a list of length 2506, in R
> 3.3.1. Similar behavior is found in 3.4.0. It seems to include all
> functions and methods. I imagine something is being passed to "grep"
> without being escaped.

Exactly; I've fixed this in r71763 (R-devel).

Martin Morgan

>
> I hope I didn't miss something in the documentation, and that I'm good
> to report this as a bug. I can send it to Bugzilla if that's better.
>
> By the way, how do I produce such a list of functions (or variables)
> in a "normal" way? I used 'ls("package:base")' for the exercise,
> because I saw this call used somewhere as an example, but I couldn't
> find that "package:" syntax documented under ls()... Also found this
> confusing:
>
>     > environmentName(globalenv())
>     [1] "R_GlobalEnv"
>     > ls("R_GlobalEnv")
>     Error in as.environment(pos) :
>       no item called "R_GlobalEnv" on the search list
>
> So I'm not sure if "package:base" is naming an environment, or if
> there are different ways to name environments and ls() is using one
> form while environmentName is returning another ... It might be good
> to add some clarifying examples under "?ls".
>
> Thanks,
>
> Frederick
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


This email message may contain legally privileged and/or...{{dropped:2}}



[Rd] methods(`|`) lists all functions?
Martin Morgan