knitr::opts_chunk$set(echo = TRUE)
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
To answer this question, I looked into data.montgomerycountymd.gov where I found the Montgomery County Public Parking Rates dataset (last updated as of July 5,2023). The dataset is extensive as it contains 21.5k cases (basically rows but in the context of the dataset, it’s the cars in which they studied). and contains 13 rows which include location, payment options, parking district and etc. To answer the question, I will only be looking at 2 columns which are duration and parking rate.
parking<- read.csv("Parking_Rates_20251023.csv")
head(parking)
## Parking.District Parking.Number Located.At Near.Latitude Near.Longitude
## 1 S 3550004 GAR 55 3.899322e+01 -7.702801e+01
## 2 S 1205907 On Street 3.898957e+01 -7.702417e+01
## 3 S 3556107 GAR 55 3.899322e+01 -7.702801e+01
## 4 S 1204703 On Street 3.899759e+01 -7.703192e+01
## 5 S 1208920 On Street 1.234570e+29 1.234570e+26
## 6 S 1201521 On Street 3.899664e+01 -7.703055e+01
## Hours.Requiring.Payment Parking.Rate Duration Who.Can.Park
## 1 7:00AM-7:00PM Monday through Friday $0.65/hr No Limit PCS
## 2 Mon-Fri, 09:00AM-06:00PM $1.00/hr 1 hour limit General Public
## 3 7:00AM-7:00PM Monday through Friday $0.65/hr No Limit PCS
## 4 Mon-Fri, 09:00AM-06:00PM $1.00/hr 2 hour limit General Public
## 5 Mon-Fri, 09:00AM-06:00PM $1.00/hr 2 hour limit General Public
## 6 Mon-Fri, 09:00AM-06:00PM $1.00/hr 2 hour limit General Public
## Payment.Options Address.1
## 1 Coins,Pay-By-Cell, Metered 1100 Bonifant Street
## 2 Coins, Pay-By-Cell On Street: GIST AVE
## 3 Coins,Pay-By-Cell, Metered 1100 Bonifant Street
## 4 Coins, Pay-By-Cell On Street: FIRST A
## 5 Coins, Pay-By-Cell On Street: RIPLEY ST
## 6 Coins, Pay-By-Cell On Street: CAMERON ST
## Address.2 Location
## 1 Accesspoints: Bonifant Street (38.99322, -77.02801)
## 2 From : FENTON ST To :PHILADELPHIA AVE (38.98957211, -77.02417473)
## 3 Accesspoints: Bonifant Street (38.99322, -77.02801)
## 4 From : FENWICK LA To :SPRING S (38.99758699, -77.03191808)
## 5 From : BONIFANT ST To :COLONIAL L (1.23457E+29, 1.23457E+26)
## 6 From : RAMSEY AVE To :GEORGIA AVE (38.99663651, -77.03054633)
To analyze the dataset, I selected only 2 columns which are the Parking.Rate and Duration columns and made a new dataset under the name of parking_clean. I cleaned the Parking.Rate column by turning the values into numbers using as.numeric(), and removing unwanted symbols ($ and /hr) to successfully convert the values. For Duration, I simplified it into two values using ifelse function that 0 represents “No Time Limit” and 1 for “1 Hour Limit”(all other durations such as 2 hour limit and higher were treated as 1 hour limit for simplicity). I summarized the statistics with summary,mean and max to see the average and highest parking rate and duration. Lastly, I made a scatterplot using plot() to visualize the relationship between parking rates and duration.
parking_clean <- parking |>
select(Parking.Rate, Duration)
parking_clean$Parking.Rate <- as.numeric(sub("/hr", "", sub("\\$", "", parking_clean$Parking.Rate)))
parking_clean$Duration_hours <- ifelse(parking_clean$Duration == "No Time Limit", 0, 1)
head(parking_clean)
## Parking.Rate Duration Duration_hours
## 1 0.65 No Limit 1
## 2 1.00 1 hour limit 1
## 3 0.65 No Limit 1
## 4 1.00 2 hour limit 1
## 5 1.00 2 hour limit 1
## 6 1.00 2 hour limit 1
#summary of stats
summary(parking_clean$Parking.Rate)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.500 0.650 0.650 0.793 0.800 2.000
summary(parking_clean$Duration_hours)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1 1 1 1 1 1
mean(parking_clean$Parking.Rate, na.rm = TRUE)
## [1] 0.7930384
max(parking_clean$Parking.Rate, na.rm = TRUE)
## [1] 2
mean(parking_clean$Duration_hours, na.rm = TRUE)
## [1] 1
max(parking_clean$Duration_hours, na.rm = TRUE)
## [1] 1
#Scatterplot
plot(
parking_clean$Parking.Rate,
parking_clean$Duration_hours,
main = "Parking Rate vs Duration (Hours)",
xlab = "Parking Rate ($)",
ylab = "Duration (Hours)",
pch = 19,
col = "red"
)
Looking at the summary analysis, the average parking rate in the dataset was about $0.79 per hour, with a max rate of $2.00 per hour. The duration data was simplified so that 0 would represent “No Time Limit” and 1 represented “1 Hour Limit”. For time’s sake and to make it easier on me to complete this report, I simplified the duration data, since including all time limits would’ve required more cleaning (that’s on me). Due to this, the scatterplot only showed points at line 1.0 of the y-axis therefore representing the 1-Hour Limit. This means most of the data in the analysis shows short-term parking rather than longer hourly durations. This plot doesn’t show a strong relationship between parking rates and duration, but it helps show how parking rates may vary even within the 1-hour limit. For future research, first off, including all duration time limits would give a full and complete understanding of whether higher parking rates influence people parking for shorter or longer amounts of time here in Montgomery County. Also, including which district zones in Montgomery County in the report would also give a better idea where most people enjoy parking (considering people would prefer cheap parking).