19.9 Seeking Help
Sometimes a second pair of eyeballs is all you need.
19.9.1 Advice on asking for help
The key to receiving help from someone is for them to rapidly grasp your problem. You should make it as easy as possible to pinpoint where the issue might be.
Try to use the correct words to describe your problem. For instance, a package is not the same thing as a library. Most people will understand what you meant, but it can make things confusing for people trying to help you. Be as precise as possible when describing your problem.
⚠️ Don’t let not knowing exactly how to describe your problem prevent you from asking. Screenshots help tremendously!
When asking someone for help try to 1. Explain what thing you are trying to do 2. Explain/show the code you wrote to try to do that thing 3. Explain/show your result, and if it’s not obvious explain why you feel it’s not the correct result. (E.g. you expected the answer to be 5, but instead it’s 10. )
⚠️ Don’t spend more than 20 minutes banging your head on the wall before you ask for help!
19.9.2 Help from inside R Studio
One of the fastest ways to get help is to use the RStudio help interface. This panel by default can be found at the lower right hand panel of RStudio. As seen in the screenshot, by typing the word mean
, RStudio tries to also give a number of suggestions that you might be interested in. The description is then shown in the display window.
❓ I know the name of the function I want to use, but I’m not sure how to use it
If you need help with a specific function, let’s say barplot()
, you can type:
If you just need to remind yourself of the names of the arguments, you can use:
❓ I want to use a function that does X, there must be a function for it but I don’t know which one…
If you are looking for a function to do a particular task, you can use the help.search()
function, which is called by the double question mark ??
. However, this only looks through the installed packages for help pages with a match to your search request.
If you can’t find what you are looking for, you can use the rdocumentation.org website that searches through the help files across all packages available.
Finally, a generic Google or internet search “R <task>” will often either send you to the appropriate package documentation or a helpful forum where someone else has already asked your question.
❓ I get an error message that I don’t understand
Start by googling the error message. However, this doesn’t always work very well because often, package developers rely on the error catching provided by R. You end up with general error messages that might not be very helpful to diagnose a problem (e.g. “subscript out of bounds”). If the message is very generic, you might also include the name of the function or package you’re using in your query.
If you check Stack Overflow, search using the [r]
tag. Most questions have already been answered, but the challenge is to use the right words in the search to find the answers: http://stackoverflow.com/questions/tagged/r
⚠️ Development of R moves pretty fast. When at all possible, use results from the past 1-2 years. Anything over 5 years old for packages such as ggplot
, dplyr
, and forcats
are likely obsolete.
19.9.3 Other Online
- In RStudio go to
Help
–>Cheatsheets
- Posit Cloud interactive lessons: https://rstudio.cloud/learn/primers
- Stack Overflow: if your question hasn’t been answered before and is well crafted, chances are you will get an answer in less than 5 min. Remember to follow their guidelines on how to ask a good question.
- The R-Studio Community: it is read by a lot of people and is more welcoming to new users than the R list-serv.
- If your question is about a specific package, see if there is a mailing list for it. Usually it’s included in the DESCRIPTION file of the package that can be accessed using
packageDescription("name-of-package")
. You may also want to try to email the author of the package directly, or open an issue on the code repository (e.g., GitHub).
19.9.4 Written
If you’re a book kinda person, there is plenty of help available as well. Many have online versions or free PDF’s.
- R Markdown, the Definitive Guide: https://bookdown.org/yihui/rmarkdown/
- R for Data Science https://r4ds.had.co.nz/
- Cookbook for R http://www.cookbook-r.com/
- R Graphics Cookbook (I use this all the time) – Chapter 8 in the above link
- The Art of R Programming https://nostarch.com/artofr.htm
- R for… http://r4stats.com/
- Excel Users https://www.rforexcelusers.com/
- SAS and SPSS Users http://r4stats.com/books/r4sas-spss/
- STATA Users http://r4stats.com/books/r4stata/