class: center, middle, inverse, title-slide # Ex. 3: More ggplot2 Commands ## Thematic and Display Adjustments --- count: false .panel1-the_chunk-auto[ ```r *employed_under_150K ``` ] .panel2-the_chunk-auto[ ``` # A tibble: 80,635 x 5 Earnings Earnings_per_member Sex Age Education <dbl> <dbl> <chr> <dbl> <chr> 1 8000 1600 F 20 Less than HS 2 4000 800 M 16 Less than HS 3 17350 8675 M 27 Less than HS 4 12000 6000 M 24 Less than HS 5 25480 25480 M 62 Bachelors 6 6000 1000 F 53 Bachelors 7 70200 11700 M 52 Bachelors 8 10520 1753. F 16 Less than HS 9 46000 11500 F 31 Some College/Associates 10 40000 40000 M 37 Less than HS # … with 80,625 more rows ``` ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% * group_by(Age, * Sex) ``` ] .panel2-the_chunk-auto[ ``` # A tibble: 80,635 x 5 # Groups: Age, Sex [134] Earnings Earnings_per_member Sex Age Education <dbl> <dbl> <chr> <dbl> <chr> 1 8000 1600 F 20 Less than HS 2 4000 800 M 16 Less than HS 3 17350 8675 M 27 Less than HS 4 12000 6000 M 24 Less than HS 5 25480 25480 M 62 Bachelors 6 6000 1000 F 53 Bachelors 7 70200 11700 M 52 Bachelors 8 10520 1753. F 16 Less than HS 9 46000 11500 F 31 Some College/Associates 10 40000 40000 M 37 Less than HS # … with 80,625 more rows ``` ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% group_by(Age, Sex) %>% * summarise(Median = median(Earnings)) ``` ] .panel2-the_chunk-auto[ ``` # A tibble: 134 x 3 # Groups: Age [67] Age Sex Median <dbl> <chr> <dbl> 1 15 F 1500 2 15 M 1500 3 16 F 2000 4 16 M 2000 5 17 F 2880 6 17 M 3200 7 18 F 4600 8 18 M 5000 9 19 F 7626. 10 19 M 10000 # … with 124 more rows ``` ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% group_by(Age, Sex) %>% summarise(Median = median(Earnings)) %>% * ggplot() ``` ] .panel2-the_chunk-auto[ <img src="ex3_embed_files/figure-html/the_chunk_auto_04_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% group_by(Age, Sex) %>% summarise(Median = median(Earnings)) %>% ggplot() + * aes(x = Age) ``` ] .panel2-the_chunk-auto[ <img src="ex3_embed_files/figure-html/the_chunk_auto_05_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% group_by(Age, Sex) %>% summarise(Median = median(Earnings)) %>% ggplot() + aes(x = Age) + * aes(y = Median) ``` ] .panel2-the_chunk-auto[ <img src="ex3_embed_files/figure-html/the_chunk_auto_06_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% group_by(Age, Sex) %>% summarise(Median = median(Earnings)) %>% ggplot() + aes(x = Age) + aes(y = Median) + * geom_line() ``` ] .panel2-the_chunk-auto[ <img src="ex3_embed_files/figure-html/the_chunk_auto_07_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% group_by(Age, Sex) %>% summarise(Median = median(Earnings)) %>% ggplot() + aes(x = Age) + aes(y = Median) + geom_line() + * aes(color = Sex) ``` ] .panel2-the_chunk-auto[ <img src="ex3_embed_files/figure-html/the_chunk_auto_08_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% group_by(Age, Sex) %>% summarise(Median = median(Earnings)) %>% ggplot() + aes(x = Age) + aes(y = Median) + geom_line() + aes(color = Sex) + * labs(x="Age (Years)") ``` ] .panel2-the_chunk-auto[ <img src="ex3_embed_files/figure-html/the_chunk_auto_09_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% group_by(Age, Sex) %>% summarise(Median = median(Earnings)) %>% ggplot() + aes(x = Age) + aes(y = Median) + geom_line() + aes(color = Sex) + labs(x="Age (Years)") + * labs(y="Earnings (USD)") ``` ] .panel2-the_chunk-auto[ <img src="ex3_embed_files/figure-html/the_chunk_auto_10_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% group_by(Age, Sex) %>% summarise(Median = median(Earnings)) %>% ggplot() + aes(x = Age) + aes(y = Median) + geom_line() + aes(color = Sex) + labs(x="Age (Years)") + labs(y="Earnings (USD)") + * labs(color = "Sex of respondent") ``` ] .panel2-the_chunk-auto[ <img src="ex3_embed_files/figure-html/the_chunk_auto_11_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% group_by(Age, Sex) %>% summarise(Median = median(Earnings)) %>% ggplot() + aes(x = Age) + aes(y = Median) + geom_line() + aes(color = Sex) + labs(x="Age (Years)") + labs(y="Earnings (USD)") + labs(color = "Sex of respondent") + * labs(title = "Age vs. Median Earnings by Sex") ``` ] .panel2-the_chunk-auto[ <img src="ex3_embed_files/figure-html/the_chunk_auto_12_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% group_by(Age, Sex) %>% summarise(Median = median(Earnings)) %>% ggplot() + aes(x = Age) + aes(y = Median) + geom_line() + aes(color = Sex) + labs(x="Age (Years)") + labs(y="Earnings (USD)") + labs(color = "Sex of respondent") + labs(title = "Age vs. Median Earnings by Sex") + * scale_x_continuous(limits=c(0,100), * breaks=c(seq(from = 0, * to = 100, * by = 10))) ``` ] .panel2-the_chunk-auto[ <img src="ex3_embed_files/figure-html/the_chunk_auto_13_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% group_by(Age, Sex) %>% summarise(Median = median(Earnings)) %>% ggplot() + aes(x = Age) + aes(y = Median) + geom_line() + aes(color = Sex) + labs(x="Age (Years)") + labs(y="Earnings (USD)") + labs(color = "Sex of respondent") + labs(title = "Age vs. Median Earnings by Sex") + scale_x_continuous(limits=c(0,100), breaks=c(seq(from = 0, to = 100, by = 10))) + * scale_y_log10() ``` ] .panel2-the_chunk-auto[ <img src="ex3_embed_files/figure-html/the_chunk_auto_14_output-1.png" width="576" /> ] <style> .panel1-the_chunk-auto { color: black; width: 49%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-the_chunk-auto { color: black; width: 49%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-the_chunk-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> <style type="text/css"> .remark-code{line-height: 1.5; font-size: 90%} @media print { .has-continuation { display: block; } } code.r.hljs.remark-code{ position: relative; overflow-x: hidden; } code.r.hljs.remark-code:hover{ overflow-x:visible; width: 500px; border-style: solid; } </style>