Source file

Please turn this lab assignment in as an html document with the .Rmd file embedded inside (like you turn in the homework)

Part 1 Frames, Glyphs, and other Components of Graphics (Chapter 6)

Look at the left hand graph called Losers and Winners in the following article: Losers and Winners. I am not asking about the right side graph with the circles only the left hand graph with the lines.

Answer these questions:

  1. What glyphs are used?

  2. What are the aesthetics for those glyphs?

  3. Which variable is mapped to each aesthetic?

  4. Which variable, if any, is used for faceting?

  5. What are the scales?

  6. What variables make up the frame:

  7. What are the guides?

  8. Write down what the glyph-ready dataframe looks like.

Part 2 Data Wrangling (chapter 7)

Here is a small data table, called flights1, based on flights in the nycflights13 package. Take this table as input. If you would like to play with this data table make sure you have nycflights13 installed on your computer (i.e. install.packages("nycflights13")).

library(nycflights13)
flights1 <-flights %>%
  select( carrier, distance, dep_delay, origin) %>%
  head(10)
flights1
## Source: local data frame [10 x 4]
## 
##    carrier distance dep_delay origin
##      (chr)    (dbl)     (dbl)  (chr)
## 1       UA     1400         2    EWR
## 2       UA     1416         4    LGA
## 3       AA     1089         2    JFK
## 4       B6     1576        -1    JFK
## 5       DL      762        -6    LGA
## 6       UA      719        -4    EWR
## 7       B6     1065        -5    EWR
## 8       EV      229        -3    LGA
## 9       B6      944        -3    JFK
## 10      AA      733        -2    LGA

For each of the following outputs, identify the operation linking the output and write down the details (i.e. arguements) of the operation. Possible operations include arrange(), filter(), summarise(), and select().
Output A

## Source: local data frame [10 x 4]
## 
##    carrier distance dep_delay origin
##      (chr)    (dbl)     (dbl)  (chr)
## 1       EV      229        -3    LGA
## 2       UA      719        -4    EWR
## 3       AA      733        -2    LGA
## 4       DL      762        -6    LGA
## 5       B6      944        -3    JFK
## 6       B6     1065        -5    EWR
## 7       AA     1089         2    JFK
## 8       UA     1400         2    EWR
## 9       UA     1416         4    LGA
## 10      B6     1576        -1    JFK

Output B

## Source: local data frame [3 x 4]
## 
##   carrier distance dep_delay origin
##     (chr)    (dbl)     (dbl)  (chr)
## 1      UA     1400         2    EWR
## 2      UA     1416         4    LGA
## 3      UA      719        -4    EWR

Output C

## Source: local data frame [2 x 4]
## 
##   carrier distance dep_delay origin
##     (chr)    (dbl)     (dbl)  (chr)
## 1      UA     1400         2    EWR
## 2      UA     1416         4    LGA

Output D

## Source: local data frame [1 x 1]
## 
##   total
##   (dbl)
## 1  -1.6

Output E

## Source: local data frame [10 x 2]
## 
##    carrier distance
##      (chr)    (dbl)
## 1       UA     1400
## 2       UA     1416
## 3       AA     1089
## 4       B6     1576
## 5       DL      762
## 6       UA      719
## 7       B6     1065
## 8       EV      229
## 9       B6      944
## 10      AA      733

Part 3 Data Camp: Visualization with ggplot2

Please do the first chapter of the Data Visualization with ggplot2 (1) called Introduction