Skip to contents

Compares column names between two objects (data frames or vectors of column names) and provides a detailed summary of unique and shared columns

Usage

compare_columns(
  obj1,
  obj2,
  obj1_name = "obj1",
  obj2_name = "obj2",
  group_by_col = NULL
)

Arguments

obj1

A data frame, tibble, or vector of column names

obj2

A data frame, tibble, or vector of column names

obj1_name

Character string naming the first object (default: "obj1")

obj2_name

Character string naming the second object (default: "obj2")

group_by_col

Character string specifying column name for grouping (default: NULL)

Value

A list containing:

  • filtered_objects: List of objects containing unique columns

  • summary_data: List of comparison statistics

  • tables: GT tables showing comparison results

Examples

# Compare column names of two data frames
compare_columns(mtcars, iris)

# Compare vectors of column names
compare_columns(names(mtcars), names(iris))