?Help()?!

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

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

ChatGPT

ChatGPT is a language model designed for natural language understanding and generation. It can – theoretically – be used for generating and annotating code and troubleshooting and you are free to use it for solving this courses tasks. There are also several possibilities to implement ChatGPT in R. Note, however, that there are several potential issues:

  1. Accuracy: ChatGPT’s responses may not always be accurate, leading to incorrect code generation or data analysis.
  2. Privacy: If sensitive or proprietary data is shared with ChatGPT during coding sessions, privacy concerns may arise.
  3. Legal: Depending on how ChatGPT is used, legal issues like copyright infringement or intellectual property violations could arise
  4. Ethical Considerations: There may be ethical concerns about the use of AI models like ChatGPT, such as biases in responses or misuse in certain contexts.

While ChatGPT might be a great help, it’s important to use it responsibly, to validate generated code, and to be mindful of legal and ethical considerations while utilizing it in real-world projects. To effectively use ChatGPT for programming-related questions and tasks, and to evaluate whether it’s accurate, you need to have a basic understanding of how R works.

Using ChatGPT for help

Note, that use of generative AI (e.g., ChatGPT1 and other LLMs) is banned when posting content on Stack Overflow, according to their policy:

“Stack Overflow is a community built upon trust. The community trusts that users are submitting answers that reflect what they actually know to be accurate and that they and their peers have the knowledge and skill set to verify and validate those answers. The system relies on users to verify and validate contributions by other users with the tools we offer, including responsible use of upvotes and downvotes. Currently, contributions generated by GPT most often do not meet these standards and therefore are not contributing to a trustworthy environment”


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:

Updated: