Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

compare_df_cols_same

Do the the data.frames have the same columns & types?


Description

Check whether a set of data.frames are row-bindable. Calls compare_df_cols()and returns TRUE if there are no mis-matching rows. '

Usage

compare_df_cols_same(
  ...,
  bind_method = c("bind_rows", "rbind"),
  verbose = TRUE
)

Arguments

...

A combination of data.frames, tibbles, and lists of data.frames/tibbles. The values may optionally be named arguments; if named, the output column will be the name; if not named, the output column will be the data.frame name (see examples section).

bind_method

What method of binding should be used to determine matches? With "bind_rows", columns missing from a data.frame would be considered a match (as in dplyr::bind_rows(); with "rbind", columns missing from a data.frame would be considered a mismatch (as in base::rbind().

verbose

Print the mismatching columns if binding will fail.

Value

TRUE if row binding will succeed or FALSE if it will fail.

See Also

Other Data frame type comparison: compare_df_cols(), describe_class()

Examples

compare_df_cols_same(data.frame(A=1), data.frame(A=2))
compare_df_cols_same(data.frame(A=1), data.frame(B=2))
compare_df_cols_same(data.frame(A=1), data.frame(B=2), verbose=FALSE)
compare_df_cols_same(data.frame(A=1), data.frame(B=2), bind_method="rbind")

janitor

Simple Tools for Examining and Cleaning Dirty Data

v2.1.0
MIT + file LICENSE
Authors
Sam Firke [aut, cre], Bill Denney [ctb], Chris Haid [ctb], Ryan Knight [ctb], Malte Grosser [ctb], Jonathan Zadra [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.