d0<-read.csv("https://opportunityinsights.org/wp-content/uploads/2018/10/tract_covariates.csv")
df <- d0[, c("czname", "hhinc_mean2000", "popdensity2000")]
df_san_antonio <- df[df$czname == "San Antonio", ]
library(ggplot2)
ggplot(df_san_antonio, aes(x = hhinc_mean2000)) + geom_histogram(binwidth = 5000)+ labs(x = "Mean Household Income (2000)", y = "Frequency")
## Warning: Removed 2 rows containing non-finite outside the scale range
## (`stat_bin()`).

ggplot(df_san_antonio, aes(y = popdensity2000)) + geom_boxplot() + labs(y = "Population Density (2000)")

ggplot(df_san_antonio, aes(x = hhinc_mean2000)) + geom_density() + labs(x = "Mean Household Income ((2000)", y = "Density")
## Warning: Removed 2 rows containing non-finite outside the scale range
## (`stat_density()`).

ggplot(df_san_antonio, aes(x = hhinc_mean2000)) + stat_ecdf(geom = "step") +labs(x = "Mean Household Income (2000)", y = "Cumulative Probability")
## Warning: Removed 2 rows containing non-finite outside the scale range
## (`stat_ecdf()`).

ggplot(df_san_antonio, aes(x = hhinc_mean2000, y = popdensity2000,)) + geom_point()+ labs(x = "Mean Household Income (2000)", y = "Population Density")
## Warning: Removed 2 rows containing missing values or values outside the scale range
## (`geom_point()`).

library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
Income_Density <- ggplot(df_san_antonio, aes(x = hhinc_mean2000, y = popdensity2000,)) + geom_point()+ labs(x = "Mean Household Income (2000)", y = "Population Density")
ggplotly(Income_Density)