petzi
petzi

Reputation: 1636

Finding a function of a specific package in RStudio help pane

Is there a way to access the function of a specific package in the help pane of RStudio?

Let's say I want to look up count() from the dplyr package:

Upvotes: 2

Views: 1900

Answers (3)

Technophobe01
Technophobe01

Reputation: 8686

RStudio HelpPane

Today the RStudio java code for help Window (see -> HelpPane.java:364) does not support the ability to search a specific package context. It could but it would require modifications to HelpSearch.java:67

./rstudio/src/gwt/src/org/rstudio/studio/client/workbench/views/help

./HelpPane.java:364:
toolbar.addRightWidget(searchProvider_.get().getSearchWidget());
./search/HelpSearch.java:67:
public Widget getSearchWidget()

RStudio

Today, in RStudio you can do a help lookup via the R console and reflect the results in the RStudio help window. The workaround is to type ?dplyr::count in the R Console and have this reflected in the RStudio help window.

enter image description here

I hope the above information if useful, and points you in the right direction. My sense is you'll need to request or change RStudio window behaviour.


R Help Observations:

If you wish to look up a specific function in a package you can use the following syntax:

help(count, package="dplyr")

Personally, I also recommend using the sos library which adds ??? this enables access to the findfn() and ??? which enables you to access RSiteSearch() and search across all CRAN libraries for a function.

> require(sos)
> 
> ???count
found 7174 matches;  retrieving 20 pages, 400 matches.
2 3 4 5 6 7 8 9 10 
11 12 13 14 15 16 17 18 19 20 

Downloaded 399 links in 244 packages. 

The above syntax is referenced in the R documentation. https://www.r-project.org/help.html

R Help: help() and ?

The help() function and ? help operator in R provide access to the documentation pages for R functions, data sets, and other objects, both for packages in the standard R distribution and for contributed packages. To access documentation for the standard lm (linear model) function, for example, enter the command help(lm) or help("lm"), or ?lm or ?"lm" (i.e., the quotes are optional).

To access help for a function in a package that’s not currently loaded, specify in addition the name of the package: For example, to obtain documentation for the rlm() (robust linear model) function in the MASS package, help(rlm, package="MASS").

Standard names in R consist of upper- and lower-case letters, numerals (0-9), underscores (_), and periods (.), and must begin with a letter or a period. To obtain help for an object with a non-standard name (such as the help operator ?), the name must be quoted: for example, help('?') or ?"?".

You may also use the help() function to access information about a package in your library — for example, help(package="MASS") — which displays an index of available help pages for the package along with some other information.

Help pages for functions usually include a section with executable examples illustrating how the functions work. You can execute these examples in the current R session via the example() command: e.g., example(lm).

Upvotes: 2

user7669
user7669

Reputation: 733

Help home, then Packages, then dplyr, then count.

Upvotes: 0

user2554330
user2554330

Reputation: 44997

There's nothing exactly equivalent to ?dplyr::count as far as I can see (but of course you could just type that in the console if you really need it).

Something sort of close is to get any dplyr help page (e.g. by doing a search for "dplyr"), then going to the bottom of the page, and clicking on Index. Alternatively, go to Packages, and scroll down to dplyr; clicking there gets you to the same place. This a list of all dplyr help topics; scroll down (or use the letter index) to get to count.

Upvotes: 1

Related Questions