Learn R Programming

clinCompare (version 1.0.0)

compare_by_group: 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)

Value

A list of comparison results for each group.

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.

Examples

Run this code
# \donttest{
  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")
# }

Run the code above in your browser using DataLab