check_and_match: A combination of 'check_values()' and 'closest_match()'.

Description Usage Arguments Details Examples

View source: R/check.R

Description

Starts interactive prompts to change not-permitted values. The white-list can also be updated depending on the argument append.

Usage

1
2
check_and_match(data, white_list, append = FALSE, margin = 1,
  insert_code = TRUE)

Arguments

data

A dataframe or list.

white_list

A named list with permitted values for required fields. Names are fields, contents are values.

append

A boolean. Should the white_list be appended to? This modifies the global variable that was passed in.

margin

A numeric, passed onto to closest_matches. Expands potential matches by increasing the distance cutoff used.

insert_code

A boolean. Should code be inserted into the active script with the record of gsub()s perfromed.

Details

If the prompt response is:

  1. a number and the name of a printed potential match, then that corresponding match is selected for substitution

  2. 'ok', then the value remains as is, no substituion occurs.

  3. Any other value, then the non-permitted value will be substituted for the prompt value.

Useful to run this without pipes if insert_code = TRUE,because of code-insertion, see examples

Examples

1
2
3
4
## Not run: 
hem_data <- check_and_match(hem_data, hem_wl)

## End(Not run)

hemoshear/assayr2 documentation built on Nov. 8, 2019, 6:13 p.m.