compare_by_group: Compare Two Datasets by Group

View source: R/compare_by_group.R

compare_by_groupR Documentation

Compare Two Datasets by Group

Description

Compares two datasets within subgroups defined by grouping variables. Performs separate comparisons for each group and returns results organized by group.

Usage

compare_by_group(df1, df2, group_vars)

Arguments

df1

A data frame representing the first dataset.

df2

A data frame representing the second dataset.

group_vars

A character vector of column names to group by.

Value

A list of comparison results for each group.

Examples


  df1 <- data.frame(region = c("A", "A", "B"), value = c(10, 20, 30),
                    stringsAsFactors = FALSE)
  df2 <- data.frame(region = c("A", "A", "B"), value = c(10, 25, 30),
                    stringsAsFactors = FALSE)
  compare_by_group(df1, df2, group_vars = "region")


clinCompare documentation built on Feb. 19, 2026, 1:07 a.m.