This is an extension of the tidytuesday assignment you have already done. Complete the questions below, using the screencast you chose for the tidytuesday assigment.
library(tidyverse)
theme_set(theme_light())
nyc_squirrels <- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-10-29/nyc_squirrels.csv")
nyc_squirrels %>%
count(zip_codes, sort = TRUE)
## # A tibble: 5 x 2
## zip_codes n
## <dbl> <int>
## 1 NA 3014
## 2 12423 4
## 3 10090 2
## 4 12081 2
## 5 12420 1
David analyzed a data set of squirrels in Central Park, leading to visualization of spatial patterns in squirrel behavior, including importing shapefiles and plotting them with ggplot.Every squirrel sighting is indentified by “hectare ID” which is a unit of square measure (long/lat). It also includes shift, which is AM or PM sighting time. the primary fur color values are either Grey,Cinnamon, or Black. Highlight fur colors are discrete values comprised of grey, cinnamon, or black. In the video it also talks about the activities the squirrrels were doing when sighted; was it running, chasing, climbing, eating, foraging or doing other activities. other variables also include audible noises and tail twitches.
Hint: One graph of your choice.
nyc_squirrels %>%
ggplot(aes(long, lat)) +
geom_point()
by_hectare <- nyc_squirrels %>%
filter(!is.na(primary_fur_color)) %>%
group_by(hectare) %>%
summarize(long = mean(long),
lat = mean(lat),
pct_gray = mean(primary_fur_color == "Gray", na.rm = TRUE),
n = n())
First, we are wondering whereabouts the data is from (could it be central park or somewhere else in NYC) so David used longitude(X) and latitude(Y) for the geom point graph. From here, we can infer that this census data is from Central Park, because we can tell it is only one park and from the blank area in the middle of the graph, it is the resevoir. The resevoir explains why there are not many boundaries because they are all in the park. The graph aggregates by the hectare, so thats why its grouped by hectare and summarize the average long and lat within each hectare.