Administrative

Please indicate

  • Roughly how much time you spent on this HW so far:
  • The URL of the RPubs published URL here.
  • What gave you the most trouble:
  • Any comments you have:

Question 1:

Use the mlb_teams.csv data set to create an informative data graphic that illustrates the relationship between winning percentage (WPct) and payroll in context. load libraries

library(ggplot2)
library(tidyverse)
## Loading tidyverse: tibble
## Loading tidyverse: tidyr
## Loading tidyverse: readr
## Loading tidyverse: purrr
## Loading tidyverse: dplyr
## Conflicts with tidy packages ----------------------------------------------
## filter(): dplyr, stats
## lag():    dplyr, stats

Winning percentage, payroll read in data

mlb<-read.csv("https://raw.githubusercontent.com/cmsc205/data/master/mlb_teams.csv")

evaluate data

summary(mlb)
##      yearID         teamID    lgID           W                L         
##  Min.   :2008   ARI    :  7   AL:100   Min.   : 51.00   Min.   : 59.00  
##  1st Qu.:2009   ATL    :  7   NL:110   1st Qu.: 73.00   1st Qu.: 72.00  
##  Median :2011   BAL    :  7            Median : 81.00   Median : 81.00  
##  Mean   :2011   BOS    :  7            Mean   : 80.99   Mean   : 80.99  
##  3rd Qu.:2013   CHA    :  7            3rd Qu.: 90.00   3rd Qu.: 89.00  
##  Max.   :2014   CHN    :  7            Max.   :103.00   Max.   :111.00  
##                 (Other):168                                             
##       WPct          attendance        normAttend        payroll         
##  Min.   :0.3148   Min.   :1335076   Min.   :0.3106   Min.   : 17890700  
##  1st Qu.:0.4506   1st Qu.:1940441   1st Qu.:0.4514   1st Qu.: 67325266  
##  Median :0.5000   Median :2418204   Median :0.5625   Median : 85803966  
##  Mean   :0.5000   Mean   :2481715   Mean   :0.5773   Mean   : 94365324  
##  3rd Qu.:0.5556   3rd Qu.:3041615   3rd Qu.:0.7076   3rd Qu.:114741109  
##  Max.   :0.6358   Max.   :4298655   Max.   :1.0000   Max.   :231978886  
##                                                                         
##     metroPop                          name    
##  Min.   : 1572245   Arizona Diamondbacks:  7  
##  1st Qu.: 2785874   Atlanta Braves      :  7  
##  Median : 4541584   Baltimore Orioles   :  7  
##  Mean   : 6014841   Boston Red Sox      :  7  
##  3rd Qu.: 6490180   Chicago Cubs        :  7  
##  Max.   :20092883   Chicago White Sox   :  7  
##                     (Other)             :168
head(mlb)
##   yearID teamID lgID  W  L      WPct attendance normAttend   payroll
## 1   2008    ARI   NL 82 80 0.5061728    2509924  0.5838859  66202712
## 2   2008    ATL   NL 72 90 0.4444444    2532834  0.5892155 102365683
## 3   2008    BAL   AL 68 93 0.4223602    1950075  0.4536477  67196246
## 4   2008    BOS   AL 95 67 0.5864198    3048250  0.7091172 133390035
## 5   2008    CHA   AL 89 74 0.5460123    2500648  0.5817280 121189332
## 6   2008    CHN   NL 97 64 0.6024845    3300200  0.7677285 118345833
##   metroPop                 name
## 1  4489109 Arizona Diamondbacks
## 2  5614323       Atlanta Braves
## 3  2785874    Baltimore Orioles
## 4  4732161       Boston Red Sox
## 5  9554598    Chicago White Sox
## 6  9554598         Chicago Cubs

plot

ggplot(mlb, aes(x = mlb$WPct*100, y = mlb$payroll/1000000)) +
  geom_point() +
  geom_smooth() +
  labs(x = "Winning Percentage (%)", y = "Payroll (dollars in millions)") +
  theme_minimal()
## `geom_smooth()` using method = 'loess'

Question 2:

Using data from the nasaweather R package, use the path geometry (i.e. use a geom_path layer) to plot the path of each tropical storm in the storms data table. Use color to distinguish the storms from one another, and use faceting to plot each year in its own panel.

Hint: Don’t forget to install and load the nasaweather R package!

load in nasaweather

library(nasaweather)
library(RColorBrewer)
mydata<-storms

evaluate storms

head(storms)
## # A tibble: 6 × 11
##      name  year month   day  hour   lat  long pressure  wind
##     <chr> <int> <int> <int> <int> <dbl> <dbl>    <int> <int>
## 1 Allison  1995     6     3     0  17.4 -84.3     1005    30
## 2 Allison  1995     6     3     6  18.3 -84.9     1004    30
## 3 Allison  1995     6     3    12  19.3 -85.7     1003    35
## 4 Allison  1995     6     3    18  20.6 -85.8     1001    40
## 5 Allison  1995     6     4     0  22.0 -86.0      997    50
## 6 Allison  1995     6     4     6  23.3 -86.3      995    60
## # ... with 2 more variables: type <chr>, seasday <int>
summary(storms)
##      name                year          month             day       
##  Length:2747        Min.   :1995   Min.   : 6.000   Min.   : 1.00  
##  Class :character   1st Qu.:1995   1st Qu.: 8.000   1st Qu.: 9.00  
##  Mode  :character   Median :1997   Median : 9.000   Median :18.00  
##                     Mean   :1997   Mean   : 8.803   Mean   :16.98  
##                     3rd Qu.:1999   3rd Qu.:10.000   3rd Qu.:25.00  
##                     Max.   :2000   Max.   :12.000   Max.   :31.00  
##       hour             lat             long            pressure     
##  Min.   : 0.000   Min.   : 8.30   Min.   :-107.30   Min.   : 905.0  
##  1st Qu.: 3.500   1st Qu.:17.25   1st Qu.: -77.60   1st Qu.: 980.0  
##  Median :12.000   Median :25.00   Median : -60.90   Median : 995.0  
##  Mean   : 9.057   Mean   :26.67   Mean   : -60.87   Mean   : 989.8  
##  3rd Qu.:18.000   3rd Qu.:33.90   3rd Qu.: -45.80   3rd Qu.:1004.0  
##  Max.   :18.000   Max.   :70.70   Max.   :   1.00   Max.   :1019.0  
##       wind            type              seasday     
##  Min.   : 15.00   Length:2747        Min.   :  3.0  
##  1st Qu.: 35.00   Class :character   1st Qu.: 84.0  
##  Median : 50.00   Mode  :character   Median :103.0  
##  Mean   : 54.68                      Mean   :102.6  
##  3rd Qu.: 70.00                      3rd Qu.:125.0  
##  Max.   :155.00                      Max.   :185.0

distinguish storms by color

library(plyr)
## -------------------------------------------------------------------------
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## -------------------------------------------------------------------------
## 
## Attaching package: 'plyr'
## The following objects are masked from 'package:dplyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## The following object is masked from 'package:purrr':
## 
##     compact
namecount<-count(storms, 'name')
namecount
##         name freq
## 1    Alberto   87
## 2       Alex   26
## 3    Allison   33
## 4        Ana   19
## 5     Arlene   26
## 6     Arthur   22
## 7      Barry   21
## 8     Bertha   50
## 9      Beryl    9
## 10      Bill    9
## 11    Bonnie   47
## 12      Bret   26
## 13     Cesar   17
## 14   Chantal   41
## 15   Charley   12
## 16     Chris    9
## 17     Cindy   51
## 18 Claudette   16
## 19  Danielle   18
## 20     Danny   45
## 21      Dean   21
## 22     Debby   20
## 23    Dennis   64
## 24     Dolly   24
## 25      Earl   33
## 26   Edouard   73
## 27     Emily   18
## 28     Erika   67
## 29      Erin   27
## 30   Ernesto   10
## 31    Fabian   17
## 32     Felix   69
## 33  Florence   29
## 34     Floyd   48
## 35      Fran   71
## 36   Frances   21
## 37 Gabrielle   10
## 38   Georges   64
## 39      Gert   49
## 40    Gordon   28
## 41     Grace   13
## 42    Gustav   29
## 43    Harvey   12
## 44    Helene   42
## 45   Hermine   14
## 46  Hortense   52
## 47  Humberto   41
## 48     Irene   30
## 49      Iris   65
## 50     Isaac   52
## 51   Isidore   33
## 52      Ivan   36
## 53    Jeanne   54
## 54     Jerry   22
## 55      Jose   32
## 56 Josephine   46
## 57     Joyce   28
## 58     Karen   31
## 59      Karl   26
## 60   Katrina   16
## 61     Keith   32
## 62      Kyle    6
## 63     Lenny   39
## 64    Leslie   26
## 65      Lili   59
## 66      Lisa   21
## 67      Luis   66
## 68     Marco   54
## 69   Marilyn   77
## 70   Michael   22
## 71     Mitch   76
## 72    Nadine   13
## 73    Nicole   35
## 74      Noel   45
## 75      Opal   37
## 76     Pablo   16
## 77   Roxanne   54
## 78 Sebastien   19
## 79     Tanya   29
#79 row, 79 different names, only want tropical storms
namecount<-count(mydata, 'name')
namecount
##         name freq
## 1    Alberto   87
## 2       Alex   26
## 3    Allison   33
## 4        Ana   19
## 5     Arlene   26
## 6     Arthur   22
## 7      Barry   21
## 8     Bertha   50
## 9      Beryl    9
## 10      Bill    9
## 11    Bonnie   47
## 12      Bret   26
## 13     Cesar   17
## 14   Chantal   41
## 15   Charley   12
## 16     Chris    9
## 17     Cindy   51
## 18 Claudette   16
## 19  Danielle   18
## 20     Danny   45
## 21      Dean   21
## 22     Debby   20
## 23    Dennis   64
## 24     Dolly   24
## 25      Earl   33
## 26   Edouard   73
## 27     Emily   18
## 28     Erika   67
## 29      Erin   27
## 30   Ernesto   10
## 31    Fabian   17
## 32     Felix   69
## 33  Florence   29
## 34     Floyd   48
## 35      Fran   71
## 36   Frances   21
## 37 Gabrielle   10
## 38   Georges   64
## 39      Gert   49
## 40    Gordon   28
## 41     Grace   13
## 42    Gustav   29
## 43    Harvey   12
## 44    Helene   42
## 45   Hermine   14
## 46  Hortense   52
## 47  Humberto   41
## 48     Irene   30
## 49      Iris   65
## 50     Isaac   52
## 51   Isidore   33
## 52      Ivan   36
## 53    Jeanne   54
## 54     Jerry   22
## 55      Jose   32
## 56 Josephine   46
## 57     Joyce   28
## 58     Karen   31
## 59      Karl   26
## 60   Katrina   16
## 61     Keith   32
## 62      Kyle    6
## 63     Lenny   39
## 64    Leslie   26
## 65      Lili   59
## 66      Lisa   21
## 67      Luis   66
## 68     Marco   54
## 69   Marilyn   77
## 70   Michael   22
## 71     Mitch   76
## 72    Nadine   13
## 73    Nicole   35
## 74      Noel   45
## 75      Opal   37
## 76     Pablo   16
## 77   Roxanne   54
## 78 Sebastien   19
## 79     Tanya   29
mypalette<-brewer.pal(12, "Paired")
Tropicalstorms<-filter(storms, type =="Tropical Storm")
ggplot(data = Tropicalstorms, aes(x = Tropicalstorms$long, y = Tropicalstorms$lat, group = Tropicalstorms$name, colour = Tropicalstorms$name)) +
 geom_path(stat = 'identity') +
  facet_wrap(~year) +
  xlab("Longitude") + ylab("Latitude") +
  ggtitle("Tropical Storm Paths")

Question 3:

Using the data set Top25CommonFemaleNames.csv, recreate the “Median Names for Females with the 25 Most Common Names” graphic from FiveThirtyEight (link to graphic; link to full article). load in dataset

library(viridis)
## Loading required package: viridisLite
library(ggthemes)
femalenames<-read.csv("https://raw.githubusercontent.com/cmsc205/data/master/Top25CommonFemaleNames.csv")
summary(femalenames)
##       name          n         est_num_alive         q1_age     
##  Amanda : 1   Min.   : 72.0   Min.   : 636663   Min.   :12.00  
##  Ashley : 1   1st Qu.:110.0   1st Qu.: 698105   1st Qu.:23.00  
##  Barbara: 1   Median :111.0   Median : 781127   Median :30.00  
##  Carol  : 1   Mean   :106.2   Mean   : 915910   Mean   :36.84  
##  Deborah: 1   3rd Qu.:111.0   3rd Qu.:1010349   3rd Qu.:51.00  
##  Donna  : 1   Max.   :111.0   Max.   :2209707   Max.   :56.00  
##  (Other):19                                                    
##    median_age        q3_age     
##  Min.   :19.00   Min.   :27.00  
##  1st Qu.:35.00   1st Qu.:42.00  
##  Median :43.00   Median :53.00  
##  Mean   :45.28   Mean   :52.96  
##  3rd Qu.:58.00   3rd Qu.:66.00  
##  Max.   :64.00   Max.   :73.00  
## 
arrange(femalenames, median_age)
##         name   n est_num_alive q1_age median_age q3_age
## 1      Emily 111      689727.5     12         19     27
## 2     Ashley  72      804870.7     18         24     28
## 3    Jessica 111     1010348.9     21         27     32
## 4      Sarah 111      872465.8     19         28     36
## 5     Amanda 111      743784.5     23         28     33
## 6  Stephanie 111      698104.6     23         31     42
## 7    Melissa 111      715709.1     28         35     43
## 8   Jennifer  93     1406036.7     29         36     42
## 9  Elizabeth 111     1129408.9     23         38     57
## 10   Rebecca 111      660999.3     25         38     53
## 11  Michelle  93      764100.0     29         40     46
## 12  Kimberly  78      781127.1     30         41     48
## 13     Laura 111      636662.9     30         43     53
## 14      Lisa 104      909266.6     40         47     51
## 15     Karen 110      875021.1     47         54     61
## 16     Susan 111      969314.1     50         57     63
## 17     Donna 111      686294.0     51         57     65
## 18   Deborah 111      662363.1     51         57     61
## 19    Sandra 107      746714.8     49         58     66
## 20  Patricia 111     1238622.1     52         61     68
## 21     Nancy 111      768937.3     53         61     68
## 22      Mary 111     2209707.0     52         62     73
## 23     Linda 111     1232858.0     55         62     66
## 24   Barbara 111     1045870.2     56         64     72
## 25     Carol 111      639431.5     55         64     70
ggplot(femalenames) +
  geom_point(mapping= aes(x = name, y = median_age)) +
  coord_flip()

ggplot(femalenames, mapping = aes(x = reorder(name, -median_age), y = median_age)) +
  geom_point(color = "red", stat = 'identity', size = 1.5, show.legend = TRUE) +
  geom_linerange(ymin = femalenames$q1_age, ymax = femalenames$q3_age, size = 3, color = "yellow", alpha = 0.2, show.legend = TRUE) +
  scale_y_continuous(position = "top") +
    coord_flip() +
labs(x= NULL, y = NULL, title = "Median Ages For Females With the 25 Most Common Names", subtitle="Among Americans estimated to be alive as of Jan. 1, 2014") +
  geom_text(x = 16.1, y = 25.9, label = "25th") +
  geom_text(x = 16.1, y = 50, label = "75th percentile")

  theme_minimal()
## List of 57
##  $ line                 :List of 6
##   ..$ colour       : chr "black"
##   ..$ size         : num 0.5
##   ..$ linetype     : num 1
##   ..$ lineend      : chr "butt"
##   ..$ arrow        : logi FALSE
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_line" "element"
##  $ rect                 :List of 5
##   ..$ fill         : chr "white"
##   ..$ colour       : chr "black"
##   ..$ size         : num 0.5
##   ..$ linetype     : num 1
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_rect" "element"
##  $ text                 :List of 11
##   ..$ family       : chr ""
##   ..$ face         : chr "plain"
##   ..$ colour       : chr "black"
##   ..$ size         : num 11
##   ..$ hjust        : num 0.5
##   ..$ vjust        : num 0.5
##   ..$ angle        : num 0
##   ..$ lineheight   : num 0.9
##   ..$ margin       :Classes 'margin', 'unit'  atomic [1:4] 0 0 0 0
##   .. .. ..- attr(*, "valid.unit")= int 8
##   .. .. ..- attr(*, "unit")= chr "pt"
##   ..$ debug        : logi FALSE
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ axis.title.x         :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         : NULL
##   ..$ hjust        : NULL
##   ..$ vjust        : num 1
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       :Classes 'margin', 'unit'  atomic [1:4] 5.5 0 0 0
##   .. .. ..- attr(*, "valid.unit")= int 8
##   .. .. ..- attr(*, "unit")= chr "pt"
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ axis.title.x.top     :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         : NULL
##   ..$ hjust        : NULL
##   ..$ vjust        : num 0
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       :Classes 'margin', 'unit'  atomic [1:4] 0 0 5.5 0
##   .. .. ..- attr(*, "valid.unit")= int 8
##   .. .. ..- attr(*, "unit")= chr "pt"
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ axis.title.y         :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         : NULL
##   ..$ hjust        : NULL
##   ..$ vjust        : num 1
##   ..$ angle        : num 90
##   ..$ lineheight   : NULL
##   ..$ margin       :Classes 'margin', 'unit'  atomic [1:4] 0 5.5 0 0
##   .. .. ..- attr(*, "valid.unit")= int 8
##   .. .. ..- attr(*, "unit")= chr "pt"
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ axis.title.y.right   :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         : NULL
##   ..$ hjust        : NULL
##   ..$ vjust        : num 0
##   ..$ angle        : num -90
##   ..$ lineheight   : NULL
##   ..$ margin       :Classes 'margin', 'unit'  atomic [1:4] 0 0 0 5.5
##   .. .. ..- attr(*, "valid.unit")= int 8
##   .. .. ..- attr(*, "unit")= chr "pt"
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ axis.text            :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : chr "grey30"
##   ..$ size         :Class 'rel'  num 0.8
##   ..$ hjust        : NULL
##   ..$ vjust        : NULL
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       : NULL
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ axis.text.x          :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         : NULL
##   ..$ hjust        : NULL
##   ..$ vjust        : num 1
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       :Classes 'margin', 'unit'  atomic [1:4] 2.2 0 0 0
##   .. .. ..- attr(*, "valid.unit")= int 8
##   .. .. ..- attr(*, "unit")= chr "pt"
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ axis.text.x.top      :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         : NULL
##   ..$ hjust        : NULL
##   ..$ vjust        : num 0
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       :Classes 'margin', 'unit'  atomic [1:4] 0 0 2.2 0
##   .. .. ..- attr(*, "valid.unit")= int 8
##   .. .. ..- attr(*, "unit")= chr "pt"
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ axis.text.y          :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         : NULL
##   ..$ hjust        : num 1
##   ..$ vjust        : NULL
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       :Classes 'margin', 'unit'  atomic [1:4] 0 2.2 0 0
##   .. .. ..- attr(*, "valid.unit")= int 8
##   .. .. ..- attr(*, "unit")= chr "pt"
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ axis.text.y.right    :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         : NULL
##   ..$ hjust        : num 0
##   ..$ vjust        : NULL
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       :Classes 'margin', 'unit'  atomic [1:4] 0 0 0 2.2
##   .. .. ..- attr(*, "valid.unit")= int 8
##   .. .. ..- attr(*, "unit")= chr "pt"
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ axis.ticks           : list()
##   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
##  $ axis.ticks.length    :Class 'unit'  atomic [1:1] 2.75
##   .. ..- attr(*, "valid.unit")= int 8
##   .. ..- attr(*, "unit")= chr "pt"
##  $ axis.line            : list()
##   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
##  $ axis.line.x          : NULL
##  $ axis.line.y          : NULL
##  $ legend.background    : list()
##   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
##  $ legend.margin        :Classes 'margin', 'unit'  atomic [1:4] 0.2 0.2 0.2 0.2
##   .. ..- attr(*, "valid.unit")= int 1
##   .. ..- attr(*, "unit")= chr "cm"
##  $ legend.spacing       :Class 'unit'  atomic [1:1] 0.4
##   .. ..- attr(*, "valid.unit")= int 1
##   .. ..- attr(*, "unit")= chr "cm"
##  $ legend.spacing.x     : NULL
##  $ legend.spacing.y     : NULL
##  $ legend.key           : list()
##   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
##  $ legend.key.size      :Class 'unit'  atomic [1:1] 1.2
##   .. ..- attr(*, "valid.unit")= int 3
##   .. ..- attr(*, "unit")= chr "lines"
##  $ legend.key.height    : NULL
##  $ legend.key.width     : NULL
##  $ legend.text          :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         :Class 'rel'  num 0.8
##   ..$ hjust        : NULL
##   ..$ vjust        : NULL
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       : NULL
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ legend.text.align    : NULL
##  $ legend.title         :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         : NULL
##   ..$ hjust        : num 0
##   ..$ vjust        : NULL
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       : NULL
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ legend.title.align   : NULL
##  $ legend.position      : chr "right"
##  $ legend.direction     : NULL
##  $ legend.justification : chr "center"
##  $ legend.box           : NULL
##  $ legend.box.margin    :Classes 'margin', 'unit'  atomic [1:4] 0 0 0 0
##   .. ..- attr(*, "valid.unit")= int 1
##   .. ..- attr(*, "unit")= chr "cm"
##  $ legend.box.background: list()
##   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
##  $ legend.box.spacing   :Class 'unit'  atomic [1:1] 0.4
##   .. ..- attr(*, "valid.unit")= int 1
##   .. ..- attr(*, "unit")= chr "cm"
##  $ panel.background     : list()
##   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
##  $ panel.border         : list()
##   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
##  $ panel.spacing        :Class 'unit'  atomic [1:1] 5.5
##   .. ..- attr(*, "valid.unit")= int 8
##   .. ..- attr(*, "unit")= chr "pt"
##  $ panel.spacing.x      : NULL
##  $ panel.spacing.y      : NULL
##  $ panel.grid.major     :List of 6
##   ..$ colour       : chr "grey92"
##   ..$ size         : NULL
##   ..$ linetype     : NULL
##   ..$ lineend      : NULL
##   ..$ arrow        : logi FALSE
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_line" "element"
##  $ panel.grid.minor     :List of 6
##   ..$ colour       : chr "grey92"
##   ..$ size         : num 0.25
##   ..$ linetype     : NULL
##   ..$ lineend      : NULL
##   ..$ arrow        : logi FALSE
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_line" "element"
##  $ panel.ontop          : logi FALSE
##  $ plot.background      : list()
##   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
##  $ plot.title           :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         :Class 'rel'  num 1.2
##   ..$ hjust        : num 0
##   ..$ vjust        : num 1
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       :Classes 'margin', 'unit'  atomic [1:4] 0 0 6.6 0
##   .. .. ..- attr(*, "valid.unit")= int 8
##   .. .. ..- attr(*, "unit")= chr "pt"
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ plot.subtitle        :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         :Class 'rel'  num 0.9
##   ..$ hjust        : num 0
##   ..$ vjust        : num 1
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       :Classes 'margin', 'unit'  atomic [1:4] 0 0 4.95 0
##   .. .. ..- attr(*, "valid.unit")= int 8
##   .. .. ..- attr(*, "unit")= chr "pt"
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ plot.caption         :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         :Class 'rel'  num 0.9
##   ..$ hjust        : num 1
##   ..$ vjust        : num 1
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       :Classes 'margin', 'unit'  atomic [1:4] 4.95 0 0 0
##   .. .. ..- attr(*, "valid.unit")= int 8
##   .. .. ..- attr(*, "unit")= chr "pt"
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ plot.margin          :Classes 'margin', 'unit'  atomic [1:4] 5.5 5.5 5.5 5.5
##   .. ..- attr(*, "valid.unit")= int 8
##   .. ..- attr(*, "unit")= chr "pt"
##  $ strip.background     : list()
##   ..- attr(*, "class")= chr [1:2] "element_blank" "element"
##  $ strip.placement      : chr "inside"
##  $ strip.text           :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : chr "grey10"
##   ..$ size         :Class 'rel'  num 0.8
##   ..$ hjust        : NULL
##   ..$ vjust        : NULL
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       : NULL
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ strip.text.x         :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         : NULL
##   ..$ hjust        : NULL
##   ..$ vjust        : NULL
##   ..$ angle        : NULL
##   ..$ lineheight   : NULL
##   ..$ margin       :Classes 'margin', 'unit'  atomic [1:4] 5.5 0 5.5 0
##   .. .. ..- attr(*, "valid.unit")= int 8
##   .. .. ..- attr(*, "unit")= chr "pt"
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ strip.text.y         :List of 11
##   ..$ family       : NULL
##   ..$ face         : NULL
##   ..$ colour       : NULL
##   ..$ size         : NULL
##   ..$ hjust        : NULL
##   ..$ vjust        : NULL
##   ..$ angle        : num -90
##   ..$ lineheight   : NULL
##   ..$ margin       :Classes 'margin', 'unit'  atomic [1:4] 0 5.5 0 5.5
##   .. .. ..- attr(*, "valid.unit")= int 8
##   .. .. ..- attr(*, "unit")= chr "pt"
##   ..$ debug        : NULL
##   ..$ inherit.blank: logi TRUE
##   ..- attr(*, "class")= chr [1:2] "element_text" "element"
##  $ strip.switch.pad.grid:Class 'unit'  atomic [1:1] 0.1
##   .. ..- attr(*, "valid.unit")= int 1
##   .. ..- attr(*, "unit")= chr "cm"
##  $ strip.switch.pad.wrap:Class 'unit'  atomic [1:1] 0.1
##   .. ..- attr(*, "valid.unit")= int 1
##   .. ..- attr(*, "unit")= chr "cm"
##  - attr(*, "class")= chr [1:2] "theme" "gg"
##  - attr(*, "complete")= logi TRUE
##  - attr(*, "validate")= logi TRUE
library(Hmisc)
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
## 
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:plyr':
## 
##     is.discrete, summarize
## The following objects are masked from 'package:dplyr':
## 
##     combine, src, summarize
## The following objects are masked from 'package:base':
## 
##     format.pval, round.POSIXt, trunc.POSIXt, units