What to do if you get lost in R?

Before asking others for help, it’s generally a good idea to try to help yourself first. R includes extensive facilities for accessing documentation and searching for help. There are also specialized search engines for accessing information about R on internet search engines can also prove useful.

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").

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).

other examples: ?mean, ?plot, ?hist

help.start() starts and displays a hypertext based version of R’s online documentation in your default browser that provides links to locally installed versions of the R manuals, a listing of your currently installed packages and other documentation resources.

The help() function and ? operator are useful only if you already know the name of the function that you wish to use. There are also facilities in the standard R distribution for discovering functions and other objects. The following functions cast a progressively wider net. Use the help system to obtain complete documentation for these functions:

  • apropos()
  • help.search() and ??
  • RSiteSearch()
  • findfn() and ???

Online Ressources

There are internet search sites that are specialized for R searches, including search.r-project.org (which is the site used by RSiteSearch) and Rseek.org.

It is also possible to use a general search site like Google, Ecosia, Duckduckgo etc. by qualifying the search with “R”, “Cran R” or the name of an R package (or both). It can be particularly helpful to paste an error message into a search engine to find out whether others have solved a problem that you encountered.

Asking for help: If you find that you can’t answer a question or solve a problem yourself, you can ask others for help, either locally (if you know someone who is knowledgeable about R) or on the internet.

In order to ask a question effectively, it helps to phrase the question clearly, and, if you’re trying to solve a problem, to include a small, self-contained, reproducible example of the problem that others can execute. For information on how to ask questions, see, e.g., the R mailing list posting guide, and the document about how to create reproducible examples for R on Stack Overflow.

Which leads us to Stack Overflow: Stack Overflow is a well organized site for help and discussions about programming. It has excellent searchability and “R” is a very popular tag on the site. To go directly to R-related topics, visit Questions tagged R.

Using a search engine for help

Google: “searchme”: site:moer-base-r

Although this page itself does not contain a search function for keywords, it can still be searched to a limited extent with the help of Google. To do this, enter the word to be searched for in quotation marks with a colon and the keyword site: plus the URL of the Base R page. By the way this works for every site on the web. The prerequisite, however, is that it is already indexed on Google with all its subpages, which is not always the case.

For example, if you want to search for the word "ratio", it looks like this:

"ratio": site:https://geomoer.github.io/moer-base-r

Long Story short: