Learn R Programming

qol (version 1.2.1)

duplicates: Check For Duplicate Variable Names

Description

Checks for duplicate variable names in a data frame, e.g. AGE, age and Age.

Counts the number of duplicated variables in a data frame. If a variable appears three times, e.g. AGE, age and Age, the variable count will be one.

Usage

get_duplicate_var_names(data_frame)

get_duplicate_var_count(data_frame)

Value

get_duplicate_var_names(): Returns a vector of duplicate variable names.

get_duplicate_var_count(): Returns the count of duplicated variables as a numeric value.

Arguments

data_frame

The data frame which variable names to check for duplicates.

Examples

Run this code
# Example data frame
my_data <- data.frame(age    = 1,
                      AGE    = 2,
                      Age    = 3,
                      sex    = 1)

dup_var_names <- my_data |> get_duplicate_var_names()

dup_var_count <- my_data |> get_duplicate_var_count()

Run the code above in your browser using DataLab