11 Using Google and Stack Overflow

Written by Michael Chong and last updated on 7 October 2021.

11.1 Introduction

In this lesson, you will learn how to:

  • search the web for help

Prerequisite skills include:

  • knowing how Web searches fit into the troubleshooting process

Highlights:

  • the date on web resources is very important!
  • you can modify your Google search to give exact matches, specific date ranges, and specific websites
  • Stack Overflow and Stack Exchange are a great place to look, but see how the

11.2 Wait! Before you search the web…

Did you try other, more reliable resources first? Answers you find “in the wild” might be out of date, or not be the best way to accomplish your task.

Look to the When your code doesn’t work lesson on the left on where to look before you look on the Internet. In short, you might want to try:

  1. the function’s help document (?function_name)
  2. looking in this toolkit
  3. R for Data Science by Hadley Wickham

11.3 Googling

Googling (or searching with another search engine) is a key part of programming! The Internet collectively knows more about using R than any single person or resource. You just need to know how to search efficiently and effectively, and be careful with what solutions you use! Not every solution is reliable.

You probably know how to use a search engine like Google or Bing. This subsection will teach you some tips (in Google) to narrow your search to get more relevant results.

11.3.3 Exact matching

Google results include things that are related to your search, but may not contain exactly what you’re looking for. This can be frustrating if you’re looking for something specific. Use quotation marks "" to force exact matching. Then, the returned search results will include the phrase that you’ve quoted.

For example, if you’re looking for help on left_join()

11.3.4 Searching a specific site

If you want results from a specific website (e.g. StackExchange/StackOverflow) then you can use the site: modifier with your search. For example, if you want to search for how to deal with dates in the R for Data Science textbook, one way to do it is:

dates site:r4ds.had.co.nz

11.3.5 Date range

The R community moves fast! The tidyverse evolves quickly and is relatively new, so older results might no longer be relevant, or there might be better ways to do what you want to do.

Personally, I would be a bit suspicious of results before approximately 2014(ish) if the solution seems more difficult than what you expect. Of course, this varies from case to case, but it’s something to keep in mind when you’re browsing!

To narrow the date range on a Google search, use the “Tools” button:

then choose your date range:

11.4 What are Stack Overflow and Stack Exchange?

These are online Q&A communities focused around programming or other domain-specific knowledge. Chances are that, for most common problems, someone has asked about it on Stack Exchange!

Some things to pay attention to in the answer:

  1. Answer score (left side). Users can “upvote” or “downvote” responses to the question. Higher scores generally mean better answers.

  2. Answer accepted (indicated by green checkmark). The person who asked the question can mark a specific answer indicating that this solved their problem. This might not be the same as the answer with the highest score!

  3. Date and time (after each post and comment). The date is very important! How people use R has changed dramatically over the past several years, and so there are often newer, better ways to do things. As a loose rule of thumb, I would consider solutions before 2014 as probably out of date. The solution still might work, but there may be an easier way to do it now.

  4. Comments (following post). This is a good place to look for potential issues with the answer, or how to extend it to a related use case.

  5. Author reputation (bottom right corner of answer). As users ask and answer more questions, they accumulate reputation from people voting on their answers. You can loosely think of people with higher scores being more trustworthy.

11.5 Questions

11.6 Next Steps

  • If you’re troubleshooting, consider where would be most appropriate to look for help for your problem. A quick Google search rarely hurts, as long as you stay critical about what the information that’s out there.
  • Continue with the lessons in this section to learn how to ask for help effectively!

11.7 Exercises

11.7.1 Question 1

11.7.2 Question 2

11.7.3 Question 3

11.7.4 Question 4

11.7.5 Question 5

11.7.6 Question 6

11.7.7 Question 7

11.7.8 Question 8

11.7.9 Question 9

11.7.10 Question 10