Skip to contents

Advanced anonymization for educational data that preserves data utility while supporting privacy review.

Usage

anonymize_educational_data(
  data = NULL,
  method = c("mask", "hash", "pseudonymize"),
  preserve_columns = NULL,
  hash_salt = NULL,
  aggregation_level = c("individual", "section", "course", "institution")
)

Arguments

data

Data frame or tibble containing educational data

method

Identifier transformation method: "mask", "hash", or "pseudonymize". The previously advertised "aggregate" method is not supported in version 0.1.0 because it did not reliably remove row-level identifiers.

preserve_columns

Vector of column names to preserve unchanged

hash_salt

Required non-empty salt for hash-based transformation.

aggregation_level

Reserved for a future aggregation workflow. It has no effect for supported version 0.1.0 methods.

Value

A data frame of the same row shape as data, with recognized structured identifier columns transformed by the selected method. Missing and blank identifiers remain missing or blank. These transformations do not inspect free text and do not establish that a data set is anonymous or compliant with legal or institutional requirements.

Anonymize sample data

sample_data <- tibble::tibble( student_id = c("12345", "67890"), preferred_name = c("Alice Johnson", "Bob Smith"), section = c("A", "B"), participation_score = c(85, 92) )

Mask method (default)

anonymized <- anonymize_educational_data(sample_data, method = "mask")

Hash method requires a caller-provided salt

hashed <- anonymize_educational_data(sample_data, method = "hash", hash_salt = "my_salt")

Examples

sample_data <- tibble::tibble(
  student_id = c("12345", "67890"),
  preferred_name = c("Alice Johnson", "Bob Smith"),
  section = c("A", "B"),
  participation_score = c(85, 92)
)
anonymize_educational_data(sample_data)
#> # A tibble: 2 × 4
#>   student_id preferred_name section participation_score
#>   <chr>      <chr>          <chr>                 <dbl>
#> 1 Student_1  Student_1      A                        85
#> 2 Student_2  Student_2      B                        92