View source: R/data-frame-compare-structure.R
data_frame_compare_structure | R Documentation |
Compare two datasets and throw an error if they have different (a) column counts, (b) column names, and (c) column class
data_frame_compare_structure(d_original, d_current, datestamp_ignore = FALSE)
d_original |
A |
d_current |
A |
datestamp_ignore |
A |
If all check pass, and invisible TRUE
is returned.
The datestamp
column is used in metadata operations like
metadata_update_file()
and data_frame_stack_new()
. In these functions,
the datestamp
column does not have to be present.
Will Beasley
# A conventional comparison.
ds_original_1 <- tibble::tibble(
x1 = c(1, 3, 4),
x2 = letters[c(1, 3, 4)],
x3 = c(11, 13, 14)
)
ds_current <- tibble::tibble(
x1 = c(1:5, 1, 5),
x2 = c(letters[1:5], "x", "y"),
x3 = c(11, 12, 13, 14, 15, 11, 15)
)
data_frame_compare_structure(ds_original_1, ds_current)
# When comparing metadata w/ datestamp.
ds_original_2 <- tibble::tibble(
x1 = c(1, 3, 4),
x2 = letters[c(1, 3, 4)],
x3 = c(11, 13, 14),
datestamp = Sys.Date()
)
data_frame_compare_structure(ds_original_2, ds_current, datestamp_ignore = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.