Add scratch.R file.
This commit is contained in:
parent
256c7ab040
commit
55be0f38a4
45
scratch.R
Normal file
45
scratch.R
Normal file
@ -0,0 +1,45 @@
|
||||
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()
|
||||
Loading…
Reference in New Issue
Block a user