Add user data calculations.

This commit is contained in:
Nick Heppler 2025-02-18 21:46:37 -05:00
parent 5c7b7e37b0
commit 9e6dc010e2

View File

@ -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. 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} ```{r submission-histogram-survey-submissions-day-of-week, echo=TRUE, message=FALSE, fig.height=6, fig.width=8}
# Define custom color palette # Color palette
my_colors <- c( color_palette <- c(
primary = "#233f28", primary = "#233f28",
secondary = "#7e9084", secondary = "#7e9084",
tertiary = "#d9e1dd", tertiary = "#d9e1dd",
@ -123,8 +123,8 @@ survey_data %>%
mutate(DayOfWeek = factor(weekdays(CreationDate), mutate(DayOfWeek = factor(weekdays(CreationDate),
levels = c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"))) %>% # Set order of days levels = c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"))) %>% # Set order of days
ggplot(aes(x = DayOfWeek)) + ggplot(aes(x = DayOfWeek)) +
geom_bar(stat = "count", fill = my_colors["primary"], color = "black") + # Use primary color 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 = my_colors["accent"]) + # Use accent color for text 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") + xlab("Day of the Week") +
ylab("Number of Submissions") + ylab("Number of Submissions") +
ggtitle("Submissions by Day of the Week") + # Add title 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. - **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. - **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} ## Participant Analysis {.tabset}
The following section contains an analysis of tree planting by participant type. The following section contains an analysis of tree planting by participant type.