Put it into Practice

Now it’s time to try things out for yourself. Complete each of the following steps, based on what we learned in this chapter.

Unless your instructor tells you otherwise, use an R script to execute all code needed to accomplish the following:

  1. Load in the social media posts dataset (posts.csv or posts.Rds). You can download it here (csv) or here (Rds) and save it on your computer. Or you can load the file directly into R through the web at the following URL: https://learndata.net/posts.csv
  1. Select four variables to examine. Make sure to choose at least one qualitative (or ordinal) variable and one quantitative variable. Note that binary variables (with values of only 0 and 1) are considered qualitative variables.

  2. For each of these four variables, make at least two graphs. If you are submitting your work to an instructor, you will probably want to save a copy of each graph in a Word document, which you can then submit to show you completed this assignment.

    See the video at the bottom of this page for guidance on getting graphs out of R and into a Word doc. You can try using copy-paste. Another option is to take a screenshot and then paste this into your Word doc. One final option (in RStudio) is to click the “Export” button in the Plots window, allowing you to save the graph as its own file in a folder of your choosing; use the “Save as Image” option. In Word, you can then navigate to “insert” a “picture” from your device.

After completing all of this, you should save your R script file in a folder that is convenient to access. It is a good idea at the end of your work to try starting a new R session and then running your entire R script at once, to make sure you have a clean script that can fully execute. If you are submitting work to an instructor, they will likely want you to send them both your script file and a Word doc containing your graphs.