# Create sample data
patient_data <- data.frame(
patient_name = c("John Doe", "Jane Smith"),
dob = as.Date(c("1980-01-01", "1975-05-15")),
mrn = c("12345", "67890"),
age5cat = factor(c("18-64", "18-64")),
diagnosis = c("Condition A", "Condition B"),
lab_value = c(120, 95)
)
# Basic de-identification (age categories automatically retained)
result <- suppressMessages(molting(patient_data))
names(result$deidentified) # Check column names
head(result$deidentified, 2) # View de-identified data
# Use different hash method
result_md5 <- suppressMessages(
molting(patient_data, hash_method = "md5")
)
# Return only de-identified data (no lookup table)
deidentified_only <- suppressMessages(
molting(patient_data, return_lookup = FALSE)
)
# Add specific columns to PII removal
result_custom <- suppressMessages(
molting(patient_data, additional_pii_cols = c("study_id"))
)
# Specify custom identifier columns for hashing
result_ids <- suppressMessages(
molting(patient_data, id_cols = c("mrn", "dob"))
)
Run the code above in your browser using DataLab