[Rd] methods(`|`) lists all functions?
Martin Morgan
martin.morgan at roswellpark.org
Fri Dec 9 03:37:59 CET 2016
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}}
More information about the R-devel
mailing list