Heat | R Documentation |
Data for Exercise 1.29
Heat
A data frame/tibble with 301 observations on two variables
a factor with levels Utility gas
,
LP bottled gas
, Electricity
, Fuel oil
, Wood
, and
Other
a factor with levels American Indians on reservation
,
All U.S. households
, and American Indians not on reservations
Bureau of the Census, Housing of the American Indians on Reservations, Statistical Brief 95-11, April 1995.
Kitchens, L. J. (2003) Basic Statistics and Data Analysis. Pacific Grove, CA: Brooks/Cole, a division of Thomson Learning.
T1 <- xtabs(~ fuel + location, data = Heat)
T1
barplot(t(T1), beside = TRUE, legend = TRUE)
## Not run:
library(ggplot2)
ggplot2::ggplot(data = Heat, aes(x = fuel, fill = location)) +
geom_bar(position = "dodge") +
labs(y = "percent") +
theme_bw() +
theme(axis.text.x = element_text(angle = 30, hjust = 1))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.