Stacked bar chart Plot the relationship between newContruction and heating type.Grouped bar chart Plot the relationship between newContruction and heating type.Segmented bar chart Plot the relationship between newContruction and heating type.In this exercise you will learn to plot data using the ggplot2 package. To this end, you will make your own note of 4.1 Categorical vs. Categorical from Data Visualization with R.
## Observations: 1,728
## Variables: 16
## $ price <int> 132500, 181115, 109000, 155000, 86060, 120000, 1…
## $ lotSize <dbl> 0.09, 0.92, 0.19, 0.41, 0.11, 0.68, 0.40, 1.21, …
## $ age <int> 42, 0, 133, 13, 0, 31, 33, 23, 36, 4, 123, 1, 13…
## $ landValue <int> 50000, 22300, 7300, 18700, 15000, 14000, 23300, …
## $ livingArea <int> 906, 1953, 1944, 1944, 840, 1152, 2752, 1662, 16…
## $ pctCollege <int> 35, 51, 51, 51, 51, 22, 51, 35, 51, 44, 51, 51, …
## $ bedrooms <int> 2, 3, 4, 3, 2, 4, 4, 4, 3, 3, 7, 3, 2, 3, 3, 3, …
## $ fireplaces <int> 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, …
## $ bathrooms <dbl> 1.0, 2.5, 1.0, 1.5, 1.0, 1.0, 1.5, 1.5, 1.5, 1.5…
## $ rooms <int> 5, 6, 8, 5, 3, 8, 8, 9, 8, 6, 12, 6, 4, 5, 8, 4,…
## $ heating <fct> electric, hot water/steam, hot water/steam, hot …
## $ fuel <fct> electric, gas, gas, gas, gas, gas, oil, oil, ele…
## $ sewer <fct> septic, septic, public/commercial, septic, publi…
## $ waterfront <fct> No, No, No, No, No, No, No, No, No, No, No, No, …
## $ newConstruction <fct> No, No, No, No, Yes, No, No, No, No, No, No, No,…
## $ centralAir <fct> No, No, No, No, Yes, No, No, No, No, No, No, No,…
Stacked bar chart Plot the relationship between newContruction and heating type.The most common heating system overall is Hot Air. Hot air has the largest color on the chart, that color being “Pink”.
Grouped bar chart Plot the relationship between newContruction and heating type.Segmented bar chart Plot the relationship between newContruction and heating type.New, because in todays world the majority of homes have hot air heating systems.
Hint: See the code in 4.1.4 Improving the color and labeling.
## $y
## [1] "Proportion"
##
## attr(,"class")
## [1] "labels"
Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.