Created
November 24, 2023 20:01
-
-
Save MCodrescu/501e92a0cff4c63d9441c48a3afd2a1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n <- 1000 | |
first_name_list <- as.character(wakefield::name(n)) | |
last_name_list <- as.character(wakefield::name(n)) | |
age <- as.numeric(wakefield::age(n)) | |
employment <- as.character(wakefield::employment(n)) | |
# Add misspellings | |
first_name_list_misspelled <- sapply( | |
strsplit(first_name_list, ""), | |
function(x) { | |
new_letter <- sample(letters, 1) | |
position <- sample(seq_len(length(x)), 1) | |
x[position] <- new_letter | |
paste(x, collapse = "") | |
} | |
) | |
# Create Datasets | |
age_data <- data.frame( | |
first_name = first_name_list, | |
last_name = last_name_list, | |
age = age | |
) | |
employment_data <- data.frame( | |
first_name = first_name_list_misspelled, | |
last_name = last_name_list, | |
employment = employment | |
) | |
# Glimpse Data | |
dplyr::glimpse(age_data) | |
dplyr::glimpse(employment_data) | |
# Save Datasets | |
readr::write_csv( | |
age_data, | |
"data/age_data.csv" | |
) | |
readr::write_csv( | |
employment_data, | |
"data/employment_data.csv" | |
) | |
# Start DB Instance | |
drv <- duckdb::duckdb() | |
con <- DBI::dbConnect(drv) | |
# Connect with Octopus | |
octopus::view_database(con) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment