Duplicate GUID Entry Checker Function
### Function Creation
check_duplicates <- function(df, column_name) {
# Check if the column exists in the dataframe
if (!column_name %in% names(df)) {
stop("Column not found in the dataframe")
}
# Find duplicates in the specified column
duplicates <- df[duplicated(df[[column_name]]) | duplicated(df[[column_name]], fromLast = TRUE), ]
if (nrow(duplicates) > 0) {
cat("There are duplicate values in the", column_name, "column.\n")
return(duplicates)
} else {
cat("No duplicate values found in the", column_name, "column.\n")
}
}
Execute Function
### Run function
duplicates <- check_duplicates(arcon_csv, "guid")
## No duplicate values found in the guid column.