View source: R/compare_df_cols.R
Generate a comparison of data.frames (or similar objects) that indicates if they will successfully bind together by rows.
compare_df_cols( ..., return = c("all", "match", "mismatch"), bind_method = c("bind_rows", "rbind"), strict_description = FALSE )
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).
Should a summary of "all" columns be returned, only return "match"ing columns, or only "mismatch"ing columns?
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
Due to the returned "column_name" column, no input data.frame may be named "column_name".
strict_description argument is most typically used to understand
if factor levels match or are bindable. Factors are typically bindable,
but the behavior of what happens when they bind differs based on the
binding method ("bind_rows" or "rbind"). Even when
FALSE, data.frames may still bind
because some classes (like factors and characters) can bind even if they
appear to differ.
A data.frame with a column named "column_name" with a value named
after the input data.frames' column names, and then one column per
data.frame (named after the input data.frame). If more than one input has
the same column name, the column naming will have suffixes defined by
sequential use of
base::merge() and may differ from expected naming.
The rows within the data.frame-named columns are descriptions of the
classes of the data within the columns (generated by
Other Data frame type comparison:
compare_df_cols(data.frame(A=1), data.frame(B=2)) # user-defined names compare_df_cols(dfA=data.frame(A=1), dfB=data.frame(B=2)) # a combination of list and data.frame input compare_df_cols(listA=list(dfA=data.frame(A=1), dfB=data.frame(B=2)), data.frame(A=3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.