This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Cmd+Shift+Enter.
df <- read.csv("~/Downloads/stat436/e_1/urban_connectivity.csv")
head(df)
I am interested in this dataset because it is useful information for looking at walkability, and associations with other variables such as demographics, accessibility of urban areas, and income. It may help answer questions around which cities or states are most accessible, how correlated walkability is with other indicators and equity measures.
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
state_walk_avg <- df %>%
group_by(State) %>%
summarise(
avg_walk_score = mean(Walk.Score, na.rm = TRUE)
) %>%
arrange(desc(avg_walk_score))
state_walk_avg
library(ggplot2)
ggplot(state_walk_avg, aes(reorder(State, avg_walk_score), y = avg_walk_score)) +
coord_flip() +
geom_col() +
labs(title = "Avg Walk Score by State",
x = "State",
y = "Avg Walk Score") +
theme_minimal()
I wanted to make a visualization for the various states and their average walk scores–which states came up with high vs low scores, as well as the range and distribution of the scores.
Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Cmd+Option+I.
When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Cmd+Shift+K to preview the HTML file).
The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.