library(readr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
county <- read_csv("https://corgis-edu.github.io/corgis/datasets/csv/county_demographics/county_demographics.csv")
## Rows: 3139 Columns: 43
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (2): County, State
## dbl (41): Age.Percent 65 and Older, Age.Percent Under 18 Years, Age.Percent ...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
texas <- county %>%
  filter(State == "TX")
summary(texas$`Income.Median Houseold Income`)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   25098   44590   51371   52848   58747  100920
summary(texas$`Education.Bachelor's Degree or Higher`)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00   14.22   17.30   19.06   21.80   52.30
hist(texas$`Income.Median Houseold Income`,
     main = "Median Household Income (Texas Counties)",
     xlab = "Median Income")

plot(texas$`Education.Bachelor's Degree or Higher`,
     texas$`Income.Median Houseold Income`,
     main = "Education vs Income",
     xlab = "Percent Bachelor's Degree or Higher",
     ylab = "Median Household Income")

cor(texas$`Education.Bachelor's Degree or Higher`,
    texas$`Income.Median Houseold Income`,
    use = "complete.obs")
## [1] 0.5673925