Data Computing Chapter 7
September 21, 2016
Data graphics can be constructed easily when each case corresponds to a “glyph” (mark) on the graph, and each variable to a graphical attribute of that glyph such as x- or y-position, color, size, length, shape, etc. Such data is called “glyph-ready.” (The same is true for more technical presentations of data, e.g., models, predictions, etc. — once the data are set up with appropriate cases and variables, the presentation is straightforward.)
data(), View(), help(),group_by(), summarise()Let’s use the following commands to learn about our data:
data(): if your data are part of a package, this loads the data set into your R environmentView(): run in the console of RStudio to open a spreadsheet of the raw data sethelp(): if your data are part of a package, this opens a help window with details about the dataHELPrct (from the mosaicData library)Minneapolis2013 (from the DataComputing library)CountryData (from the DataComputing library)Consider the Minneapolis 2013 election data. Here’s a bar chart that might be used to show the election results:
This graph reflects the following data table (only part of which is shown):
## # A tibble: 6 x 2
## First votes
## <chr> <int>
## 1 BETSY HODGES 28935
## 2 MARK ANDREW 19584
## 3 DON SAMUELS 8335
## 4 CAM WINTON 7511
## 5 JACKIE CHERRYHOMES 3524
## 6 BOB FINE 2094
Compare the Minneapolis2013 data table and the data table printed above.
# The HELPrct data are available in the mosaicData package
library(mosaicData)
# Load the HELPrct data set into our RStudio environment
data("HELPrct")
# Also, use View(HELPrct) in the console to open a tab in RStudio and see the data set
summarise() : Find an expression involving summarize() and HELPrct that will produce the following.
HELPrct studyHELPrct (silly)HELPrctgroup_by() : repeat task 1 above, but calculate the results group-by-group and write a sentence or two about what you observe in the results for each of the following:
Include one or more interesting plots of the data involving at least 3 variables per plot. Write a few sentances to explain the story that your plot tells about these data. You can use one of the relationships that you studied in Task 2, or you can explore a different group of variables in the HELPrct that show something interesting.