rm(list=ls(all=t))
filename <- "Section_11" # !!!Update filename
functions_vers <- "functions_1.8.R" # !!!Update helper functions file
source (functions_vers)
Visually inspect variables in "dictionary.csv" and flag for risk, using the following flags:
# Direct PII: Respondent Names, Addresses, Identification Numbers, Phone Numbers
# Direct PII-team: Interviewer Names, other field team names
# Indirect PII-ordinal: Date of birth, Age, income, education, household composition.
# Indirect PII-categorical: Gender, education, ethnicity, nationality,
# occupation, employer, head of household, marital status
# GPS: Longitude, Latitude
# Small Location: Location (<100,000)
# Large Location (>100,000)
# Weight: weightVar
# Household ID: hhId,
# Open-ends: Review responses for any sensitive information, redact as necessary
# !!!No Direct PII
# !!!No Direct PII-team
# !!!No small locations
# !!!No Indirect PII - Ordinal
# !!!Include relevant variables in list below (Indirect PII - Categorical, and Ordinal if not processed yet)
indirect_PII <- c("s11q1",
"s11q3",
"s11q5",
"s11q7",
"s11q9",
"s11q11",
"s11q13",
"s11q15",
"s11q17",
"s11q19",
"s11q22")
capture_tables (indirect_PII)
# Recode those with very specific values.
# !!!No specific values
# !!! Insufficient demographic data
# !!! Identify open-end variables here:
open_ends <- c("s11q1_why",
"s11q3_why",
"s11q5_why",
"s11q7_why",
"s11q9_why",
"s11q11_why",
"s11q13_why",
"s11q15_why",
"s11q17_why",
"s11q19_why",
"s11q20_why",
"s11q22_why")
report_open (list_open_ends = open_ends)
# Review "verbatims.csv". Identify variables to be deleted or redacted and their row number
mydata$s11q13_why[1581] <- "[language]"
# !!!No GPS data
haven::write_dta(mydata, paste0(filename, "_PU.dta"))
haven::write_sav(mydata, paste0(filename, "_PU.sav"))
# Add report title dynamically
title_var <- paste0("DOL-ILAB SDC - ", filename)