From 5c7b7e37b05431a2e533cd7fcd6b764e4678b387 Mon Sep 17 00:00:00 2001 From: Nick Heppler Date: Tue, 18 Feb 2025 19:20:48 -0500 Subject: [PATCH 1/2] Modify histogram --- report.Rmd | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/report.Rmd b/report.Rmd index 7378ecf..36ca353 100644 --- a/report.Rmd +++ b/report.Rmd @@ -107,6 +107,14 @@ The histogram presented below visualizes the number of survey submissions based This chart helps identify any trends in survey participation, such as whether submissions are more frequent at the beginning or end of the week. This could be valuable for understanding user behavior and improving survey timing or outreach strategies. ```{r submission-histogram-survey-submissions-day-of-week, echo=TRUE, message=FALSE, fig.height=6, fig.width=8} +# Define custom color palette +my_colors <- c( + primary = "#233f28", + secondary = "#7e9084", + tertiary = "#d9e1dd", + accent = "#face00" +) + library(dplyr) library(ggplot2) @@ -115,11 +123,15 @@ survey_data %>% mutate(DayOfWeek = factor(weekdays(CreationDate), levels = c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"))) %>% # Set order of days ggplot(aes(x = DayOfWeek)) + - geom_bar(stat = "count") + # Create the histogram (bar plot) - geom_text(aes(label = after_stat(count)), stat = "count", vjust = -0.25) + # Add labels above the bars + geom_bar(stat = "count", fill = my_colors["primary"], color = "black") + # Use primary color + geom_text(aes(label = after_stat(count)), stat = "count", vjust = -0.25, size = 5, color = my_colors["accent"]) + # Use accent color for text xlab("Day of the Week") + ylab("Number of Submissions") + - theme(axis.text.x = element_text(angle = 45, hjust = 1)) # Angle labels for better readability + ggtitle("Submissions by Day of the Week") + # Add title + theme_minimal() + # Use a cleaner theme + theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 12), # Adjust text size for better readability + plot.title = element_text(size = 16, hjust = 0.5)) # Center title and adjust size + ``` ```{r func-plot_submission_trends, echo=TRUE} From 9e6dc010e2565f5514047c74e1534000c9c81a49 Mon Sep 17 00:00:00 2001 From: Nick Heppler Date: Tue, 18 Feb 2025 21:46:37 -0500 Subject: [PATCH 2/2] Add user data calculations. --- report.Rmd | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/report.Rmd b/report.Rmd index 36ca353..54f03cd 100644 --- a/report.Rmd +++ b/report.Rmd @@ -107,8 +107,8 @@ The histogram presented below visualizes the number of survey submissions based This chart helps identify any trends in survey participation, such as whether submissions are more frequent at the beginning or end of the week. This could be valuable for understanding user behavior and improving survey timing or outreach strategies. ```{r submission-histogram-survey-submissions-day-of-week, echo=TRUE, message=FALSE, fig.height=6, fig.width=8} -# Define custom color palette -my_colors <- c( +# Color palette +color_palette <- c( primary = "#233f28", secondary = "#7e9084", tertiary = "#d9e1dd", @@ -123,8 +123,8 @@ survey_data %>% mutate(DayOfWeek = factor(weekdays(CreationDate), levels = c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"))) %>% # Set order of days ggplot(aes(x = DayOfWeek)) + - geom_bar(stat = "count", fill = my_colors["primary"], color = "black") + # Use primary color - geom_text(aes(label = after_stat(count)), stat = "count", vjust = -0.25, size = 5, color = my_colors["accent"]) + # Use accent color for text + geom_bar(stat = "count", fill = color_palette["primary"], color = "black") + # Use primary color + geom_text(aes(label = after_stat(count)), stat = "count", vjust = -0.25, size = 5, color = color_palette["accent"]) + # Use accent color for text xlab("Day of the Week") + ylab("Number of Submissions") + ggtitle("Submissions by Day of the Week") + # Add title @@ -258,6 +258,34 @@ The following provides additional context for each survey question/field, detail - **Source of Trees**: The percentage of respondents who reported the source of the trees they planted. - **Total Number of Species Planted **: The percentage of respondents who provided the species of tree(s) they planted. +### User Data +```{r named-user-table} +library(tidyverse) + +user_activity <- survey_data %>% + mutate(Creator = ifelse(is.na(Creator), "Public User", Creator)) %>% + group_by(Creator) %>% + summarise( + record_count = n(), + total_trees_planted = sum(`Number of Trees Planted`, na.rm = TRUE) + ) +knitr::kable(user_activity, caption = "Survey Submissions by Named User", align = "l") +``` + +### User Data +```{r participant-email-table} +library(tidyverse) + +user_activity_email <- survey_data %>% + mutate(Creator = ifelse(is.na(`Planter Contact Email`), "Not Provided", `Planter Contact Email`)) %>% + group_by(`Planter Contact Email`) %>% + summarise( + record_count = n(), + total_trees_planted = sum(`Number of Trees Planted`, na.rm = TRUE) + ) +knitr::kable(user_activity_email, caption = "Survey Submissions by E-mail", align = "l") +``` + ## Participant Analysis {.tabset} The following section contains an analysis of tree planting by participant type.