Compare commits

...

2 Commits

Author SHA1 Message Date
Nick Heppler
9e6dc010e2 Add user data calculations. 2025-02-18 21:46:37 -05:00
Nick Heppler
5c7b7e37b0 Modify histogram 2025-02-18 19:20:48 -05:00

View File

@ -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}
# Color palette
color_palette <- 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 = 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") +
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}
@ -246,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.