45 lines
1.3 KiB
R
45 lines
1.3 KiB
R
library(readr)
|
|
raw <- read_csv("data/alt_fuel_stations (Sep 25 2024)_joined.csv")
|
|
|
|
library(tidyverse)
|
|
dataset <- raw %>%
|
|
select(
|
|
`Station Name`,
|
|
`City`,
|
|
`EV Level2 EVSE Num`,
|
|
`EV DC Fast Count`,
|
|
`Latitude`,
|
|
`Longitude`,
|
|
`EV Connector Types`,
|
|
`EV Workplace Charging`,
|
|
`UR20`
|
|
)
|
|
|
|
has_null_ur20 <- dataset %>%
|
|
summarise(any_null = any(is.na(UR20)))
|
|
|
|
dataset <- dataset %>%
|
|
filter(!is.na(UR20)) %>%
|
|
mutate(UR20 = recode(UR20, "R" = "Rural", "U" = "Urban"))
|
|
|
|
library(ggplot2)
|
|
library(scales)
|
|
ggplot(dataset, aes(y = factor(UR20))) +
|
|
geom_bar(aes(x = after_stat(count))) +
|
|
geom_text(stat = 'count', aes(label = comma(after_stat(count))), # Use comma for thousands separators
|
|
position = position_stack(vjust = 0.5),
|
|
color = "white") + # Set label color to white
|
|
labs(title = "Urban-Rural Station Histogram",
|
|
x = "Classification",
|
|
y = "Count") +
|
|
theme_minimal()
|
|
|
|
ggplot(dataset, aes(y = factor(UR20))) +
|
|
geom_bar(aes(x = after_stat(count))) +
|
|
geom_text(stat = 'count', aes(label = comma(after_stat(count))), # Use comma for thousands separators
|
|
position = position_stack(vjust = 0.5),
|
|
color = "white") + # Set label color to white
|
|
labs(title = "Urban-Rural Charger Histogram",
|
|
x = "Classification",
|
|
y = "Count") +
|
|
theme_minimal() |