6

How does one look up the help manual page for a function and specify the package in R? For example, count appears in both seqinr and plyr. If I want to look up count in plyr, what's the command? I've tried a few obvious (but wrong) guesses such as "?plyr::count"

EDIT: When I do ?count, I get the following message:

Help on topic 'count' was found in the following packages:

  Package               Library
  plyr                  /Library/Frameworks/R.framework/Versions/2.15/Resources/library
  seqinr                /Library/Frameworks/R.framework/Versions/2.15/Resources/library

When I do ?plyr::count, I get:

No documentation for 'plyr::count' in specified packages and libraries:
you could try '??plyr::count'

When I do ?plyr:::count, I get:

No documentation for 'plyr:::count' in specified packages and libraries:
you could try '??plyr:::count'

Adding two question marks also gets me a no documentation found error as well. Looking up help for non-ambiguous funcitons is working fine (e.g. ?plot)

This is with R 2.15.0 on OSX running in emacs + ESS.

Paul Hiemstra
  • 59,984
  • 12
  • 142
  • 149
daj
  • 6,962
  • 9
  • 45
  • 79
  • `?plyr::count` works for me on R-2.15.0 (WinXP 32-bit). – Joshua Ulrich Apr 27 '12 at 20:58
  • `?plyr::count` and `?seqinr::count` both work for me. It looks like you can also do `help("count", package = "plyr")`. Have you installed the packages? What error message do you get? – flodel Apr 27 '12 at 20:59
  • @flodel: my bet is that their [computer exploded](http://article.gmane.org/gmane.comp.lang.r.general/262206). – Joshua Ulrich Apr 27 '12 at 21:14
  • @JoshuaUlrich :-) I almost wet myself laughing at Greg's response earlier today. – Gavin Simpson Apr 27 '12 at 21:29
  • Thanks for the comments - see new edits... – daj Apr 28 '12 at 18:53
  • 2
    Ok, so you left out the one **key** bit of information. What we are showing you doesn't seem to be working in Emacs+ESS on my system either. I suggest you take this up on the ESS mailing list. I'll also re-tag here to see if anyone with Emacs+ESS fu can help. – Gavin Simpson Apr 28 '12 at 19:01

3 Answers3

6

Use the package= argument to help:

help("count", package="plyr")
Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418
  • This actually works! but why is everyone saying that the other options should work as well? The behavior is a little different though - this displays the help within the R console instead of in a separate emacs frame. Is there a way to do this with the ? notation? – daj Apr 28 '12 at 18:52
  • @daj: I have no idea, since I don't use Emacs. – Joshua Ulrich Apr 28 '12 at 20:03
4

The correct way to do this is:

?plyr::count
?plyr:::count

See ?"?" for details - both examples are shown.

Both work for me with both packages loaded and even without the package loaded. That begs the question if you have the packages installed?

Gavin Simpson
  • 170,508
  • 25
  • 396
  • 453
3

You were close, you need three : :::

?seqinr:::count # for seqinr
?plyr:::count # for plyr
nograpes
  • 18,623
  • 1
  • 44
  • 67