Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the graph for 2024 data #3

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,566 changes: 973 additions & 593 deletions R/app.R

Large diffs are not rendered by default.

Binary file modified R/ddf.rda
Binary file not shown.
2 changes: 0 additions & 2 deletions R/load_data.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


library(tidyverse)

load("ddf.rda")
Expand Down
Binary file modified R/original_question_df.rda
Binary file not shown.
10 changes: 10 additions & 0 deletions R/rsconnect/shinyapps.io/jun8/dd4g-bu-tech-majors-survey.dcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: dd4g-bu-tech-majors-survey
title:
username: jun8
account: jun8
server: shinyapps.io
hostUrl: https://api.shinyapps.io/v1
appId: 11469823
bundleId: 8368840
url: https://jun8.shinyapps.io/dd4g-bu-tech-majors-survey/
version: 1
47 changes: 36 additions & 11 deletions R/vis_helper.R
Original file line number Diff line number Diff line change
@@ -1,28 +1,50 @@
library(ggplot2)
library(scales)

stack_freq_prop <- function(g, title) {
g1 <- g +
stack_freq_prop <- function(g_22, g_24, title) {
g1 <- g_22 +
geom_col(
aes(y = count),
position = position_dodge2(preserve = "single")
) +
scale_x_discrete("", guide = guide_axis(n.dodge = 2), drop = FALSE) +
scale_fill_discrete(guide = "none", drop = FALSE) +
geom_label(aes(y = count, label = as.character(count)), vjust = "inward", colour = "black", fontface = "bold", fill = "white", position = position_dodge(width = .9)) +
ggtitle(title, subtitle = "Top: absolute counts. Bottom: relative proportions.") +
ggtitle(paste0(title, "\n2022:"), subtitle = "Top: absolute counts. Bottom: relative proportions.") +
theme(plot.title = element_text(size = 20, face = "bold"))
g2 <- g +
g2 <- g_22 +
geom_col(
aes(y = prop),
aes(y = prop_22),
position = position_dodge(preserve = "single")
) +
scale_x_discrete(guide = guide_axis(n.dodge = 2), drop = FALSE) +
scale_y_continuous(labels = scales::percent) +
scale_fill_discrete("", drop = FALSE) +
geom_label(aes(y = round(prop, digits = 2), label = as.character(percent(round(prop, digits = 2)))), vjust = "inward", colour = "black", fill = "white", fontface = "bold", position = position_dodge(width = .9)) +
geom_label(aes(y = round(prop_22, digits = 2), label = as.character(percent(round(prop_22, digits = 2)))), vjust = "inward", colour = "black", fill = "white", fontface = "bold", position = position_dodge(width = .9)) +
theme(legend.position = "bottom")
ggpubr::ggarrange(g1, g2, nrow = 2, heights = c(1, 2), align = "v")

g1_2024 <- g_24 +
geom_col(
aes(y = count),
position = position_dodge2(preserve = "single")
) +
scale_x_discrete("", guide = guide_axis(n.dodge = 2), drop = FALSE) +
scale_fill_discrete(guide = "none", drop = FALSE) +
geom_label(aes(y = count, label = as.character(count)), vjust = "inward", colour = "black", fontface = "bold", fill = "white", position = position_dodge(width = .9)) +
ggtitle("2024") +
theme(plot.title = element_text(size = 20, face = "bold"))
g2_2024 <- g_24 +
geom_col(
aes(y = prop_24),
position = position_dodge(preserve = "single")
) +
scale_x_discrete(guide = guide_axis(n.dodge = 2), drop = FALSE) +
scale_y_continuous(labels = scales::percent) +
scale_fill_discrete("", drop = FALSE) +
geom_label(aes(y = round(prop_24, digits = 2), label = as.character(percent(round(prop_24, digits = 2)))), vjust = "inward", colour = "black", fill = "white", fontface = "bold", position = position_dodge(width = .9)) +
theme(legend.position = "bottom")

ggpubr::ggarrange(g1, g2, g1_2024, g2_2024, nrow = 4, align = "v")
}


Expand All @@ -46,18 +68,21 @@ count_prop_complete <- function(df, ..., .fill = TRUE) {
"Often times"
)


if(any(as.character(df$response) %in% agreement_level)){
df <- df %>% mutate(response = fct_drop(response, only = frequency_level))
} else if(any(as.character(df$response) %in% frequency_level)){
df <- df %>% mutate(response = fct_drop(response, only = agreement_level))
}

df %>%
group_by(...) %>%
count(response, name = "count") %>%
mutate(prop = count / sum(count)) %>%
group_by(..., response, year) %>%
summarize(count = n()) %>%
ungroup() %>%
mutate(ct_22 = ifelse(year == 2022, count, 0),
ct_24 = ifelse(year == 2024, count, 0)) %>%
mutate(prop_22 = count / sum(ct_22)) %>%
mutate(prop_24 = count / sum(ct_24)) %>%
mutate(prop = prop_24) %>%
complete(..., response, fill = fill_vals) %>%
group_by(...)
}
35 changes: 0 additions & 35 deletions README.Rmd

This file was deleted.

74 changes: 61 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,74 @@

# deiSurveyShiny
# DEI Student Survey Shiny App

<!-- badges: start -->
![R](https://img.shields.io/badge/r-%23276DC3.svg?style=for-the-badge&logo=r&logoColor=white)

<!-- badges: end -->

The goal of deiSurveyShiny is to …
## Project Description
The DEI in Tech Climate Survey was motivated by the need to better understand student experiences in tech related departments at BU in an effort to inform areas for change and improvement. The biannual DEI in Tech Climate Survey initiatives aim to evaluate the environment within tech departments at Boston University and address the existing data gap. This application was developed to provide a user-friendly interface for the survey data, and to allow for easy visualization and analysis of the survey results.

### Team Member Contributions (2024)
- **Project Manager/Team Lead/Data Visualization**: [Naomy Bopela]([email protected])
- **Shiny Development**: [Anush Veeranala]([email protected])
- **Shiny Development**: [Stella Zhai]([email protected])
- **Shiny Development**: [Jack Campbell](https://www.linkedin.com/in/jack-campbell-a392191a1/)
- **Data Cleaning/Visualization/Team Lead**: [Riya Parikh]([email protected])
- **Data Cleaning/Visualization**: [Bohan Wang]([email protected])
- **Data Cleaning/Visualization**: [Ryan Ko]([email protected])

## Installation
### Prerequisites

Ensure you have R installed on your system. You can download and install R from [The Comprehensive R Archive Network (CRAN)](https://cran.r-project.org/).

You can install the development version of deiSurveyShiny from
[GitHub](https://github.com/) with:
### Installing Required Packages

``` r
# install.packages("devtools")
devtools::install_github("dpmcsuss/deiSurveyShiny")
Open R or RStudio, and run the following commands in the console. These commands will install the necessary packages for the application.

```r
install.packages("shiny")
install.packages("ggplot2")
install.packages("shinyjs")
install.packages("shinyBS")
install.packages("shinyalert")
install.packages("gt")
install.packages("dplyr")
install.packages("readr")
install.packages("tidyverse")
install.packages("scales")
```

## Example
## Running the Application (locally)
1. Clone the repository to your local machine.
2. Open R or RStudio, and set the working directory to the location of the 'R' folder.
3. Install required packages (if not already installed).
4. Open the app.R file and run.

## Code of Conduct
## Dataset Locations
- The datasets used for this project is located in the 'data-raw' folder of the Github repository.

## Blockers

Please note that the deiSurveyShiny project is released with a
[Contributor Code of
Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).
### Data Cleaning

- string data with the multi-select options are hard to deal with when creating visuals
- Unsure if excluding survey results that were unfinished impact accuracy of the results of our data analysis

### Solution
- fixed with identifying each individual string value with commas and then splitting on this delimiter thought about simply not including those unfinished surveysquestioned needs of stakeholders decided to use NaN in place of unfinished results within surveys; to preserve integrity of survey/ unsure of needs of stakeholder

## Software

### understanding the web application development process
- figuring out how to clean data to be applied to filters in shiny application as a result of gaps in the provided survey data
- ran into version control issues

### Solution
- merged the changes manually to resolve this.
- merged the data from both 2022 and 2024, applied filters, and adjusted the graphs to accurately depict comparison

## Code of Conduct
Please note that the DEI in Tech Climate Survey Project is released with a
[Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.
5 changes: 0 additions & 5 deletions app.R

This file was deleted.

1,205 changes: 1,205 additions & 0 deletions data-raw/2024 DEITC Student Survey_March 11, 2024_Final All.csv

Large diffs are not rendered by default.

Binary file not shown.
Loading