help.start()13 Getting Help in R
Learning Objectives: After this chapter you will be able to:
- Look up any known function with
?nameorhelp().- Search help topics when you do not know the function name.
- Read a package’s documentation, examples, and vignettes.
- Decide when the built-in help system is enough and when to go online.
13.1 Introduction
In this chapter, we will learn about the different methods of getting help in R. We often get stuck during an analysis because we do not know which function to use or its syntax. Anyone new to R should know where to look for help. There are two ways to look for help in R:
- online
- built-in help system
In the first section, we will look at online resources. We will then look at the built-in help system and package documentation. Let us get started!
13.2 Online Resources
13.2.1 R Bloggers
R Bloggers aggregates blogs written in English from across the globe. This is the first place to visit for help with R, data analysis, visualization and machine learning. There are blogs on a wide range of topics and the latest content is delivered to your inbox if you subscribe. If you are a blogger yourself, share it with the R community by adding your blog to R Bloggers.
13.2.2 Stack Overflow
Stack Overflow is a place to ask for help with R code or packages. Someone may have encountered a similar problem, and you can use the answers given by R experts. If you encounter a new problem, you can ask for help by providing a reproducible example of your analysis along with the R code. Use the reprex package to create reproducible examples.
13.2.3 Posit Community
Posit Community is similar to Stack Overflow. You can ask questions related to RStudio, Shiny and tidyverse. You can also use #rstats on Mastodon or Bluesky.
13.2.4 RStudio
RStudio has resources including cheatsheets, webinars and blogs.
13.2.5 Reddit
Reddit is another place to look for help. The discussions are moderated by R experts. There are subreddits for Rstats, Rlanguage, Rstudio and Rshiny.
13.2.6 R Weekly
Visit RWeekly to get regular updates about the R community. You can find information about new packages, blogs, conferences, workshops, tutorials and R jobs.
13.2.7 R User Groups
Several R User Groups are active across the globe. You can find the list here. Join the local user group to meet, discuss and learn from other R enthusiasts and experts.
13.3 Internal
We can use the following functions to access the built-in help system:
help.start()help()???help.search()demo()example()library()vignette()browseVignettes()
13.3.1 help.start
The help.start() function opens the documentation page in your browser. Here you can find manuals, references and other materials.
13.3.2 help
Use help() to access the documentation of functions and data sets. ? is a shortcut for help() and returns the same information.
help(plot)
?plot13.3.3 help.search
help.search() searches all sources of documentation and returns those that match the search string. ?? is a shortcut for help.search() and returns the same information.
help.search('regression')
??regression13.3.4 demo
demo displays an interactive demonstration of certain topics provided in an R package. Typing demo() in the console lists the demos available in installed R packages.
demo()
demo(scoping)13.3.5 example
example() displays examples of the specified topic if available.
example('mean')
mean> x <- c(0:10, 50)
mean> xm <- mean(x)
mean> c(xm, mean(x, trim = 0.10))
[1] 8.75 5.50
13.4 Package Documentation
13.4.1 library
Access the documentation of a package using the help argument to library(). The package must be installed. For packages you have not installed, read the CRAN page or its pkgdown site.
library(help = 'ggplot2')13.4.2 vignette
A vignette is a long-form guide to an R package. You can access vignettes using vignette(). It displays a list of vignettes available in installed packages.
vignette()To access a specific vignette from a package, specify the name of the vignette and the package.
vignette('dplyr', package = 'dplyr')13.4.3 browseVignettes
browseVignettes() is another way to access the vignettes in installed packages. It lists the vignettes in each package with links to the web page and R code.
browseVignettes()13.4.4 RSiteSearch
RSiteSearch() searches for specified topics in help pages, vignettes and task views using the search engine at this link. It returns the result in a browser.
RSiteSearch('glm')Key points
- Use
help()or?when you know the function name. - Use
help.search()or??to search documentation by topic. library(help = ...)andvignette()show documentation for installed packages.- When asking online, share your R code and a reproducible example.
Next: About the Author