Code
# Import packages and working dataset
library(tidyverse)
library(haven)
library(plotly)
library(gt)
df_es <- readRDS("./data/ES2_NameSurvey_2025-09-09.RDS")
# Get weighted mean using the survey weight variable
get_mean <- function(var_es, wgt_es){
weighted.mean({{var_es}}, w = {{wgt_es}}, na.rm = TRUE)
}