-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Update documentation to midwest variables #4274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ee3e94c
f429522
80beae6
bedfed0
95d14f5
763d499
132edcd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,16 +48,21 @@ | |
|
||
#' Midwest demographics | ||
#' | ||
#' Demographic information of midwest counties | ||
#' Demographic information of midwest counties from 2000 US census | ||
#' | ||
#' Note: this dataset is included for illustrative purposes. The original | ||
#' descriptions were not documented and the current descriptions here are based | ||
#' on speculation. For more accurate and up-to-date US census data, see the | ||
#' [`acs` package](https://cran.r-project.org/package=acs). | ||
#' | ||
#' @format A data frame with 437 rows and 28 variables: | ||
#' \describe{ | ||
#' \item{PID}{} | ||
#' \item{county}{} | ||
#' \item{state}{} | ||
#' \item{area}{} | ||
#' \item{poptotal}{Total population} | ||
#' \item{popdensity}{Population density} | ||
#' \item{PID}{Unique county identifier.} | ||
#' \item{county}{County name.} | ||
#' \item{state}{State to which county belongs to.} | ||
#' \item{area}{Area of county (units unknown).} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for The other variables here ( |
||
#' \item{poptotal}{Total population.} | ||
#' \item{popdensity}{Population density (person/unit area).} | ||
#' \item{popwhite}{Number of whites.} | ||
#' \item{popblack}{Number of blacks.} | ||
#' \item{popamerindian}{Number of American Indians.} | ||
|
@@ -69,17 +74,17 @@ | |
#' \item{percasian}{Percent Asian.} | ||
#' \item{percother}{Percent other races.} | ||
#' \item{popadults}{Number of adults.} | ||
#' \item{perchsd}{} | ||
#' \item{perchsd}{Percent with high school diploma.} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not very reliable, but I found someone's homework that lists I couldn't verify this, but given the surrounding other variables on education status ( |
||
#' \item{percollege}{Percent college educated.} | ||
#' \item{percprof}{Percent profession.} | ||
#' \item{poppovertyknown}{} | ||
#' \item{percpovertyknown}{} | ||
#' \item{percbelowpoverty}{} | ||
#' \item{percchildbelowpovert}{} | ||
#' \item{percadultpoverty}{} | ||
#' \item{percelderlypoverty}{} | ||
#' \item{inmetro}{In a metro area.} | ||
#' \item{category}{} | ||
#' \item{percprof}{Percent with professional degree.} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For |
||
#' \item{poppovertyknown}{Population with known poverty status.} | ||
#' \item{percpovertyknown}{Percent of population with known poverty status.} | ||
#' \item{percbelowpoverty}{Percent of people below poverty line.} | ||
#' \item{percchildbelowpovert}{Percent of children below poverty line.} | ||
#' \item{percadultpoverty}{Percent of adults below poverty line.} | ||
#' \item{percelderlypoverty}{Percent of elderly below poverty line.} | ||
Comment on lines
+80
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is validated with some manual calculations to check if our manual calculation of percent poverty is equal to the one in the data set. library(ggplot2)
library(dplyr)
data("midwest")
# Find number of counties our manual calculation fails
midwest %>%
select(poptotal, poppovertyknown, percpovertyknown) %>%
mutate(manual_percpoverty = poppovertyknown / poptotal * 100) %>%
mutate(not_equal_per = !all.equal(percpovertyknown, manual_percpoverty)) %>%
pull(not_equal_per) %>%
sum()
#> [1] 0 Created on 2020-11-27 by the reprex package (v0.3.0) The remaining variables ( |
||
#' \item{inmetro}{County considered in a metro area.} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For |
||
#' \item{category}{Miscellaneous.} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For |
||
#' } | ||
#' | ||
"midwest" | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reference
https://github.com/hadley/ggplot2-book/blob/a55525c4fc9e4a2f2a951639047a4175ee0fa8a6/statistical-summaries.Rmd#L40