From 73c3533850fde7cc882152d297b1fcd0644afad4 Mon Sep 17 00:00:00 2001 From: Nick Heppler Date: Thu, 8 May 2025 10:30:18 -0400 Subject: [PATCH] Parse Submitted date from Survey ID and update CreationDate where applicable; add key findings metrics for reporting. --- report.Rmd | 111 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 87 insertions(+), 24 deletions(-) diff --git a/report.Rmd b/report.Rmd index 413381d..3d790e2 100644 --- a/report.Rmd +++ b/report.Rmd @@ -39,6 +39,7 @@ library(tigris) library(scales) library(RColorBrewer) library(viridis) +library(lubridate) # Define file paths survey_path <- "data/_25_Million_Trees_Initiative_Survey_0.csv" @@ -66,26 +67,45 @@ vendors <- read_csv(vendors_path) # Convert character dates to POSIXct survey_data <- survey_data %>% - mutate(CreationDate = mdy_hms(CreationDate)) + mutate(CreationDate = mdy_hms(CreationDate)) %>% + mutate(`Start Date of Planting (Required)` = mdy_hms(`Start Date of Planting (Required)`)) %>% + mutate(`End Date of Planting (Required)` = mdy_hms(`End Date of Planting (Required)`)) %>% + mutate(`Who Planted The Tree(s)? (Required)` = recode(`Who Planted The Tree(s)? (Required)`, + "agency" = "State Agency", + "community" = "Community Organization", + "landowner" = "Private Landowner", + "municipality" = "Municipal Government", + "professional" = "Paid Professional")) + +survey_data <- survey_data %>% + mutate( + Submitted_Date_Str = str_extract(`Survey ID`, "Submitted: \\d{2}-\\d{2}-\\d{2}") %>% + str_remove("Submitted: "), + + Submitted_Date_Str = if_else( + !is.na(Submitted_Date_Str), + paste0("20", Submitted_Date_Str), # add "20" prefix to "24-11-07" + NA_character_ + ), + + Submitted_Date = as.Date(Submitted_Date_Str, format = "%Y-%m-%d"), + + CreationDate = if_else( + !is.na(`Survey ID`) & str_trim(`Survey ID`) != "", + Submitted_Date, + CreationDate + ) + ) %>% + select(-Submitted_Date_Str, -Submitted_Date) # Count and filter records based on exclusion flag -start_date <- format(min(survey_data$CreationDate, na.rm = TRUE), "%B %d, %Y") -end_date <- format(max(survey_data$CreationDate, na.rm = TRUE), "%B %d, %Y") +survey_data <- survey_data %>% + filter(`Exclude Result` == 0) +start_date_submission <- format(min(survey_data$CreationDate, na.rm = TRUE), "%B %d, %Y") +end_date_submission <- format(max(survey_data$CreationDate, na.rm = TRUE), "%B %d, %Y") excluded_count <- survey_data %>% filter(`Exclude Result` == 1) %>% nrow() used_count <- survey_data %>% filter(`Exclude Result` == 0) %>% nrow() total_records <- excluded_count + used_count - - -survey_data <- survey_data %>% - filter(`Exclude Result` == 0) - -# Join related datasets by GlobalID -combined_data <- survey_data %>% - left_join(location_points, by = c("GlobalID" = "ParentGlobalID")) %>% - left_join(location_polygons, by = c("GlobalID" = "ParentGlobalID")) %>% - left_join(participant_organizations, by = c("GlobalID" = "ParentGlobalID")) %>% - left_join(species_planted, by = c("GlobalID" = "ParentGlobalID")) %>% - left_join(vendors, by = c("GlobalID" = "ParentGlobalID")) ``` --- @@ -96,9 +116,58 @@ subtitle: "`r format(min(survey_data$CreationDate, na.rm = TRUE), "%B %d, %Y")` [Back to Top](#) -## Background +## Key Findings +```{r key-findings-summary} +kf_date_planting_start <- format(min(survey_data$`Start Date of Planting (Required)`, na.rm = TRUE), "%B %d, %Y") +kf_date_planting_end <- format(max(survey_data$`End Date of Planting (Required)`, na.rm = TRUE), "%B %d, %Y") +kf_total_trees <- format(sum(survey_data$`Number of Trees Planted (Required)`), big.mark = ",") -The **25 Million Trees Initiative** is a major environmental commitment announced by **Governor Kathy Hochul** in the 2024 State of the State Address. Its goal is to plant 25 million trees across New York State by 2033 to support climate resilience, improve community well-being, and enhance biodiversity. +kf_region_total_trees_ranked <- survey_data %>% + group_by(Region) %>% + summarise(Total_Trees = sum(`Number of Trees Planted (Required)`, na.rm = TRUE)) %>% + arrange(desc(Total_Trees)) + +kf_participant_total_trees_ranked <- survey_data %>% + group_by(`Who Planted The Tree(s)? (Required)`) %>% + summarise(Total_Trees = sum(`Number of Trees Planted (Required)`, na.rm = TRUE)) %>% + arrange(desc(Total_Trees)) + +kf_dac_total_trees <- sum(survey_data$`Number of Trees Planted (Required)`[!is.na(survey_data$`Disadvantaged Communities Indicator`)], na.rm = TRUE) +kf_dac_percent <- (kf_dac_total_trees / sum(survey_data$`Number of Trees Planted (Required)`, na.rm = TRUE)) * 100 +kf_dac_percent_display <- round(kf_dac_percent, 1) + +kf_generic_tree_type_ranked <- species_planted %>% + filter(!is.na(`Generic Type of Tree (Optional)`)) %>% + count(`Generic Type of Tree (Optional)`, name = "Survey_Count") %>% + arrange(desc(Survey_Count)) + +kf_most_common_generic_tree_type <- kf_generic_tree_type_ranked$`Generic Type of Tree (Optional)`[1] +kf_most_common_generic_tree_type_count <- kf_generic_tree_type_ranked$Survey_Count[1] +kf_most_common_generic_tree_type_count_formatted <- format(kf_most_common_generic_tree_type_count, big.mark = ",") + +kf_total_surveys <- nrow(survey_data) +kf_total_surveys_formatted <- format(kf_total_surveys, big.mark = ",") + +kf_unique_counties <- n_distinct(survey_data$County) +kf_unique_counties_formatted <- format(kf_unique_counties, big.mark = ",") + +kf_unique_municipalities <- n_distinct(survey_data$Municipality) +kf_unique_municipalities_formatted <- format(kf_unique_municipalities, big.mark = ",") +``` + +Between **`r kf_date_planting_start` and `r kf_date_planting_end`**, a total of **`r kf_total_trees` trees** were reported planted across **New York State** through the 25 Million Trees by 2033 Initiative. + +These efforts reflect broad collaboration between **municipal governments**, **community organizations**, **private landowners**, and other stakeholders. + +- **Most Trees Planted**: The highest number of trees were reported in **`r kf_region_total_trees_ranked$Region[1]`**, followed by **`r kf_region_total_trees_ranked$Region[2]`**. +- **Top Planting Groups**: The most trees, approximately **`r scales::comma(kf_participant_total_trees_ranked$Total_Trees[1])`**, were planted by **`r kf_participant_total_trees_ranked$"Who Planted The Tree(s)? (Required)"[1]`**, followed by **`r kf_participant_total_trees_ranked$"Who Planted The Tree(s)? (Required)"[2]`**, which contributed **`r scales::comma(kf_participant_total_trees_ranked$Total_Trees[2])`** trees. +- **Disadvantaged Communities**: Approximately **`r kf_dac_percent_display`%** of all trees were planted in **Disadvantaged Communities**, as defined by New York State’s Climate Act. +- **Most Reported Tree Genus**: **`r kf_most_common_generic_tree_type`** appeared most frequently, reported in **`r kf_most_common_generic_tree_type_count_formatted`** surveys. +- The project received data from **`r kf_total_surveys_formatted` unique surveys**, representing **`r kf_unique_counties_formatted` counties** and **`r kf_unique_municipalities_formatted` municipalities**. + +These findings help track progress toward equity-centered climate goals, highlight areas of strong participation, and support data-driven planning for future tree planting across the state. + +## Background To track progress, the **New York State Department of Environmental Conservation (DEC)** launched the **Tree Tracker**, a public-facing survey tool built on the ***ArcGIS Survey123***. It allows individuals and organizations to submit information about tree planting efforts, including species, quantity, and location. These submissions feed into a real-time dashboard that maps tree planting activities across the state. @@ -116,7 +185,7 @@ By understanding planting behavior statewide, DEC can better allocate resources ## Survey Period & Exclusions -This analysis covers submissions from **`r start_date`** to **`r end_date`**, totaling **`r total_records`** records. Of these, **`r used_count`** records were deemed valid and included in the analysis. +This analysis covers submissions from **`r start_date_submission`** to **`r end_date_submission`**, totaling **`r total_records`** records. Of these, **`r used_count`** records were deemed valid and included in the analysis. ### Excluded Records @@ -516,12 +585,6 @@ This table presents a detailed summary of tree planting activity by participant ```{r participant-type-table, echo=TRUE} survey_data %>% - mutate(`Who Planted The Tree(s)? (Required)` = recode(`Who Planted The Tree(s)? (Required)`, - "agency" = "State Agency", - "community" = "Community Organization", - "landowner" = "Private Landowner", - "municipality" = "Municipal Government", - "professional" = "Paid Professional")) %>% create_summary_table("Who Planted The Tree(s)? (Required)", "Number of Trees Planted (Required)", remove_na = FALSE, table_font_size = 16) ```