Update global.R - UCSB-MEDS/shiny-dashboard GitHub Wiki
global.R
is a script for storing commonly used pieces of logic and objects that you want available to both ui.R
and server.R
. It's great for reducing redundant code. We use this file to load necessary packages, import our data, create some variables and data frames based on our imported data, etc. You will need to update global.R
each time new data are added, following these steps:
-
Locate
global.R
inshiny-dashboard/bren-student-data-explorer/
. It should always live alongside the other app files (ui.R
,server.R
). -
Filter initial career placement data for the three most recent years: This dashboard displays career placement data for only the three most recent graduating classes. We made this choice primarily because starting salaries from earlier years may not reflect current hiring trends due to factors like inflation. Update the filter statements where we generate the two objects named
mesm_placement
andmeds_placement
. E.g.:
#................initial placement data (cleaned)................
mesm_placement <- readRDS("data/mesm_placement_cleaned.rds") |> filter(year %in% c(2022:2024))
meds_placement <- readRDS("data/meds_placement_cleaned.rds") |> filter(year %in% c(2022:2024))
- Update active placement file names and filter for the three most recent years: Active placement (status) data are pre-processed in the
career-data
repo and saved as two separate files:mesm_status_YYYY_YYYY.rds
andmeds_status_YYYY_YYYY.rds
, whereYYYY_YYYY
indicates the graduating class year range represented in each dataset. Update the file path with the new file names, and load them into the objects namedmesm_status
andmeds_status
. Then revise the filter statements to filter for the three most recent years. E.g.:
#............active placement (status) data (cleaned)............
mesm_status <- readRDS("data/mesm_status_2019_2024.rds") |> filter(class_year %in% c(2022:2024))
meds_status <- readRDS("data/meds_status_2022_2024.rds") |> filter(class_year %in% c(2022:2024))
- Update
curr_grad_year
to the most recent graduating class for which we have career outcome data. For example, in Spring 2025 we made updates to the dashboard to display career outcome data for MEDS/MESM graduating classes of 2022-2024. Therefore,curr_grad_year
was set to 2024:
#..............set most recent graduated class year..............
# career data for graduating classes of 202* used in career tab
curr_grad_year <- 2024