Skip to content

harvard-ufds/bosTrees

Repository files navigation

bosTrees

bosTrees is a data package that contains information on trees and tree planting sites in Boston, Massachusetts. This package includes two distinct datasets, each offering unique insights into the urban forestry of Boston:

  • bosTrees pulls in data on 6,836 primary street trees located throughout Boston.

  • camTrees pulls in data on 38,050 trees and tree planting sites owned, planted or maintained by the City of Cambridge, the Massachusetts Department of Conservation and Recreation, and MIT, Harvard University and other private organizations

The data pulled for camTrees is maintained by the Cambridge Public Works and updated regularly by the City Arborist while the bosTrees dataset was created by the City of Boston’s GIS Team.

Installation

# Do the following once
# install.packages("devtools")

# Then, install the package
devtools::install_github("harvard-ufds/bosTrees")

Examples

Trees are fun to visualize! Here is a simple bar graph of the 5 most common trees in Boston, MA:

library(bosTrees)
library(tidyverse)
# Find the names of the 5 most common species
top5 <- bosTrees %>%
  count(CommonName) %>%
  arrange(desc(n)) %>%
  drop_na(CommonName) %>%
  slice_max(n = 5, n)

# Filter down to 5 common species
most_common <- bosTrees %>%
  filter(CommonName %in% top5$CommonName)

# Create a bar graph of the 5 top species
ggplot(most_common, aes(x = fct_infreq(CommonName), fill = factor(CommonName))) +
  geom_bar() +
  theme(axis.title.x = element_blank(),
        axis.text.x =
          element_text(angle = 30,
                       vjust = 1,
                       hjust=1),
        legend.position = "none") +
  labs(title = "5 Most Common Trees in Boston",
       y = "Number of Trees") +
  scale_fill_manual(values = c("#2ca25f", "#31572c", "#90a955", "#66c2a4", "#006d2c"))

You can even plot the latitudes and longitudes of the common trees to see them in a map view:

ggplot(most_common, aes(x = Longitude, y = Latitude, color = CommonName)) +
  geom_point(alpha = 0.3) +
  theme(axis.title.x = element_blank(),
        axis.title.y = element_blank(),
        legend.title = element_blank(),
        legend.position = "bottom")

You can also use the camTrees dataset to take a closer look at the trees in Cambridge, MA specifically:

# Filter down to the area of Charles River around Harvard's campus and create a scatterplot
camTrees %>%
  filter(Longitude > -71.13, Longitude < -71.11, Latitude > 42.359, Latitude < 42.375) %>%
ggplot(aes(x = Longitude, y = Latitude, color = Ownership)) +
  geom_point() +
  xlim(-71.13, -71.11) +
  ylim(42.359, 42.375) +
  labs(title = "Ownership of Trees alongside Charles River on Harvard's Campus")

References

Data originally published in:

About

Datasets on Trees in Boston and Cambridge, MA

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages