Skip to contents

Review 1 column comparing it to another one and spots differences

Usage

review_one_variable(
  dataset,
  column_to_review,
  column_to_compare_with,
  uuid_column = "uuid",
  prefix = "review",
  return_dataset = FALSE
)

Arguments

dataset

A dataset to be check.

column_to_review

Name of the column to review.

column_to_compare_with

Name of the column to compare with.

uuid_column

uuid column in the dataset. Default is uuid.

prefix

Prefix to be used for the review and comment column. Default is "review".

return_dataset

Logical, if the result table should be returned. Default is "FALSE".

Value

The review table, or the review table added to the results.

Examples

test_numeric <- data.frame(
  test = c(
    "test equality",
    "test difference",
    "test Missing in y",
    "test Missing in x",
    "test equality rounding in x",
    "test equality rounding in y",
    "test difference rounding in x",
    "test difference rounding in y"
  ),
  var_x = c(0, 1, 2, NA, 0.00019, 0.0002, 0.00035, 0.0003),
  var_y = c(0, 2, NA, 3, 0.0002, 0.00019, 0.0003, 0.00035),
  uuid = letters[1:8]
)
review_one_variable(test_numeric,
  column_to_review = "var_x",
  column_to_compare_with = "var_y"
)
#>   uuid review_check_var_x review_comment_var_x
#> 1    a               TRUE         Same results
#> 2    b              FALSE    Different results
#> 3    c              FALSE     Missing in var_y
#> 4    d              FALSE     Missing in var_x
#> 5    e               TRUE         Same results
#> 6    f               TRUE         Same results
#> 7    g              FALSE    Different results
#> 8    h              FALSE    Different results