class: center, middle, inverse, title-slide # Ex. 4.2: Bar Plot --- 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 %>% * ggplot() ``` ] .panel2-the_chunk-auto[ <img src="ex4.2_embed_files/figure-html/the_chunk_auto_02_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% ggplot() + * aes(x = Sex) ``` ] .panel2-the_chunk-auto[ <img src="ex4.2_embed_files/figure-html/the_chunk_auto_03_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% ggplot() + aes(x = Sex) + * aes(fill = Sex) ``` ] .panel2-the_chunk-auto[ <img src="ex4.2_embed_files/figure-html/the_chunk_auto_04_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% ggplot() + aes(x = Sex) + aes(fill = Sex) + # bar is a special case of geom col # It counts the number of observations # And this is the y ie height of the column * geom_bar() ``` ] .panel2-the_chunk-auto[ <img src="ex4.2_embed_files/figure-html/the_chunk_auto_05_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% ggplot() + aes(x = Sex) + aes(fill = Sex) + # bar is a special case of geom col # It counts the number of observations # And this is the y ie height of the column geom_bar() + * labs(x = "Earnings (USD)") ``` ] .panel2-the_chunk-auto[ <img src="ex4.2_embed_files/figure-html/the_chunk_auto_06_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% ggplot() + aes(x = Sex) + aes(fill = Sex) + # bar is a special case of geom col # It counts the number of observations # And this is the y ie height of the column geom_bar() + labs(x = "Earnings (USD)") + * labs(y = "Count") ``` ] .panel2-the_chunk-auto[ <img src="ex4.2_embed_files/figure-html/the_chunk_auto_07_output-1.png" width="576" /> ] --- count: false .panel1-the_chunk-auto[ ```r employed_under_150K %>% ggplot() + aes(x = Sex) + aes(fill = Sex) + # bar is a special case of geom col # It counts the number of observations # And this is the y ie height of the column geom_bar() + labs(x = "Earnings (USD)") + labs(y = "Count") + * labs(title = "Bar Plot of Total Earnings by Sex") ``` ] .panel2-the_chunk-auto[ <img src="ex4.2_embed_files/figure-html/the_chunk_auto_08_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>