compare: Compare two objects

Description Usage Arguments Examples

View source: R/compare.R

Description

Compare two objects using compare::compare(), comparing only the attributes in compare_attrs and ignoring classes in ignore_classes.

Usage

1
2
3
4
5
6
7
compare(
  model,
  comparison,
  compare_attrs = c("class", "names", "groups", "row.names"),
  ignore_classes = "spec_tbl_df",
  ...
)

Arguments

model

The "correct" object.

comparison

The object to be compared with model.

compare_attrs

String or vector of strings of attributes to compare. Default is to compare only class, groups, names, and row.names attributes. Use NULL to compare all attributes.

ignore_classes

String or vector of strings of classes to ignore. Default is to ignore spec_tbl_df class. Use NULL to not ignore classes.

...

Arguments to be passed to compare::compare().

Examples

1
2
3
4
5
6
7
df1 <- data.frame(x = 1, y = 2)
df2 <- df1
attr(df2, "class") <- c("spec_tbl_df", attr(df1, "class"))
attr(df2, "foo") <- "bar"

# Compare objects
compare(df1, df2)

stanford-datalab/dcl documentation built on March 24, 2021, 8:44 a.m.