compareVars {R.AlphA.Home}R Documentation

Compare Table Variables

Description

Compares column names in two tables based on a given pattern. Provides information about which columns are present in which tables.

Usage

compareVars(x, y, pattern = "")

Arguments

x

A data frame representing the first table.

y

A data frame representing the second table.

pattern

A string pattern used to filter and compare only a subset of variables (column names).

Value

A list containing:

Examples

# Example tables
table1 <- data.frame(exclusive_1 = 1:5, common_1 = 6:10, common_2 = 11:15)
table2 <- data.frame(common_1 = 16:20, common_2 = 21:25, exclusive_2 = 26:30)

# Compare all columns (no pattern given)
compare_all <- compareVars(table1, table2)
compare_all$common
compare_all$exclusive
compare_all$onlyX
compare_all$onlyY

# compare only columns following a specific pattern
compare_wPattern <- compareVars(table1, table2, pattern = "1")
compare_wPattern$all
compare_wPattern$common

[Package R.AlphA.Home version 1.0.0 Index]