Annually, the U.S. Department of Housing and Urban Development (HUD) sets Fair Market Rents (FMRs). FMRs determine the amount that rental subsidies will provide to low-income earners in each region. Unfortunately, the FMRs are a low-ball estimate of actual rental prices, which means that rental subsidies are too small effectively house recipients. This map shows the disparity between actual rental prices and FMRs in San Francisco in 2014.

The 2014 HUD estimate for San Francisco was $1,551 for a one bedroom apartment; in theory, this accounts for rent and expected utility costs. A person collected a Section 8 subsidy would be given a voucher to account for 1/3 of that expected FMR. However, Craigslist showed that the true median rental price for a one-bedroom was $3,150. The points marked in green show Craigslist listings that would be affordable for a subsidy recipient ($1,551 and less)– notice they are few. Markers in yellow and orange are listings that fall into the actual median rental price revealed from Craigslist data ($1,552-3,150). Listings in red are above the median price set by HUD and available Craigslist data ($3,151+). This map shows the dearth of housing available in San Francisco for Section 8 subsidy recipients.

The Craigslist data (2014) was accessed courtesy of Geoff Boeing and Paul Waddell of UC Berkeley’s City and Regional Planning Department.

setwd("/Users/cassandrabayer/Desktop/Spring 2017/DDS")
library(tidyr)

library(stats)
library(tidyverse)
## Loading tidyverse: ggplot2
## Loading tidyverse: tibble
## Loading tidyverse: readr
## Loading tidyverse: purrr
## Loading tidyverse: dplyr
## Conflicts with tidy packages ----------------------------------------------
## filter(): dplyr, stats
## lag():    dplyr, stats
library(shiny)
library(ggplot2)
library(devtools)
library(dplyr)
library(leaflet)
cl_whole <- read.csv("rents_with_commutes.csv") #data from whole Bay Area
cl_whole <- cl_whole[cl_whole$SUPERD<=4,] #capture only SF 
vars <- c("rent","bedrooms", "title", "neighborhood", "SUPERD", "title", "bedrooms", "latitude", "longitude")
cl_whole<- cl_whole[,vars]

cl_whole <- cl_whole %>% filter(complete.cases(.)) #weed out spam hopefully
#cl_whole$bedrooms <- as.character(cl_whole$bedrooms)
cl_whole <- cl_whole %>% filter(bedrooms==1) #just get one bedroom places
median(cl_whole$rent) #median rent is 3150
## [1] 3150
#get markers based on bedroom and rent
 #get just SF

getColor <- function(cl_whole) {
  sapply(cl_whole$rent, function(rent) {
  if(rent <= 1551) {
    "green"
  } else if(rent <= 3150) {
    "orange"
  } else {
    "red"
  } })
}

icons <- awesomeIcons(
  icon = 'ios-close',
  iconColor = 'black',
  library = 'ion',
  markerColor = getColor(cl_whole)
)

#Interactive map: green for ACS FMR, yellow for Craigslist, red for neither
leaflet(cl_whole) %>% addTiles() %>%
  addAwesomeMarkers(~longitude, ~latitude, icon=icons, label=~as.character(rent),
  clusterOptions = markerClusterOptions()) %>%
      fitBounds(-122.428, 37.659645,-122.237708, 37.922)