replace_firstname: Replace the firstnames with values from another database.

Description Usage Arguments Value Examples

View source: R/mask_sensitive_variable.R

Description

replace_firstname replaces the firstname in dataset with firstname from another database (see firstname_uk and firstname_us) in case they are too sensitive.

Usage

1
2
3
4
5
6
7
replace_firstname(
  dataset,
  country = "uk",
  age_dependency = TRUE,
  gender_dependency = TRUE,
  race_dependency = FALSE
)

Arguments

dataset

A data frame of the dataset.

country

A string variable with a default of 'uk'. It is either 'uk' or 'us'.

age_dependency

A logical variable with a default of TRUE.

gender_dependency

A logical variable with a default of TRUE.

race_dependency

A logical variable with a default of FALSE.

Value

A data frame of the dataset with the firstname column being replaced by another firstname database.

Examples

1
2
3
4
df <- data.frame(sex=sample(c('male', 'female'), 30, replace = TRUE))
df <- add_variable(df, "nhsid")
df <- add_variable(df, "firstname", country = "uk", gender_dependency= TRUE, age_dependency = FALSE)
replace_firstname(df, country = 'us', age_dependency = FALSE)

sdglinkage documentation built on April 27, 2020, 5:09 p.m.