Source file ⇒ Lab_3.Rmd
Part 1
Answer these questions:
- What glyphs are used?
- The glyphs are the red lines that show the change in the portion of family income needed to pay for university costs from 1971 to 2011 divided into the different quintiles of income distribution.
- What are the aesthetics for those glyphs?
- Color, x-y coordinates, location, and labels are used to represent the red line.
- Which variable is mapped to each aesthetic?
- location: the variable “year” is mapped to the x-axis and the variable “annual family income” is mapped to the y-axis
- label: the quintile names (“Wealthiest Fifth”, “Next Fifth”, etc.) are assigned to the label
- Which variable, if any, is used for faceting?
- In this example, there is no variable usedd for faceting
- What are the scales?
- For the x-axis aesthetic, the scales are 1971 and 2011, since there are only two years being compared.
- The scale for the annual percentage is the range from 6 to 114
- What variables make up the frame?
- The x-coordinate iis defined by years and the the y-coordinate are defined by annual income percentages
- What are the guides?
- The guides in this graph are the red points which show the different quintiles of the annual incomes of the graph
- Write down what the glyph-ready data frame looks like:
| Wealthiest Fifth |
6 |
9 |
| Next Fifth |
10 |
19 |
| Middle Fifth |
13 |
29 |
| Second Poorest Fifth |
19 |
46 |
| Poorest Fifth |
42 |
114 |
Part 2
Output A flights1 %>% + select(carrier, distance, dep_delay, origin) %>% + arrange(distance)
Output B flights1 %>% + filter(carrier == “UA”)
Output C flights1 %>% + select(carrier, distance, dep_delay, origin) %>% + head(2)
Output D flights1 %>% + summarise(total=mean(dep_delay))
Output E flights1 %>% + select(carrier, distance)