Learn R Programming

sdglinkage (version 0.1.0)

replace_firstname: Replace the firstnames with values from another database.

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

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

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab