This page holds a table of the 130 metrics that are used in the refined framework and in subsequent analyses. The metadata can be browsed below, and links to the source of each metric can be found by hitting the arrow on the left side of each row. You can also download the file as a .csv using the button provided.
Code
# Get latest year functionsource('dev/data_pipeline_functions.R')# Load metrics datasm_data <-readRDS('data/sm_data.rds')metrics <- sm_data$metrics# Load refined frameworkraw_tree <- sm_data[['refined_tree']]# Load refined frameworkframe <-readRDS('data/frame.rds')# Pull it from the actual metrics datametrics <- sm_data$metrics %>% dplyr::filter( variable_name %in% frame$variable_name, fips %in% sm_data$state_key$state_code )get_str(metrics)length(unique(metrics$variable_name))# Filter to latest year for each metric, and pivot wider# Also removing census participation - don't really have data at state level# Note to aggregate counties for this at some pointmetrics_df <- metrics %>%mutate(value =ifelse(value =='NaN', NA, value),value =str_remove_all(value, ','),value =as.numeric(value) ) %>%get_latest_year() %>%pivot_wider(names_from ='variable_name',values_from ='value' ) %>%unnest(cols =!fips) %>%unique()get_str(metrics_df)# Let's get rid of the years so they are easier to work withnames(metrics_df) <-str_split_i(names(metrics_df), '_', 1)get_str(metrics_df)# Also get rid of DC - too many missing valuesmetrics_df <- metrics_df %>% dplyr::filter(fips !='11')# Save this for use in subsequent pagessaveRDS(metrics_df, 'data/metrics_df.rds')
Below, the metrics are displayed in a table that lets you browse and explore them.