fixed_check: Check for inconsistency in variables that should be fixed

Description Usage Arguments Examples

Description

This function checks whether one set of variables is consistent within values of another set of variables. If they are, returns TRUE. If they aren't, it will return a list of data frames, one for each element of .var, consisting only of the observations and variables in which there are inconsistencies.

Usage

1
fixed_check(.df, .var = NULL, .within = NULL)

Arguments

.df

Data frame, pibble, or tibble.

.var

Quoted or unquoted variable(s) in .df that are to be checked for consistency. If not specified, uses all variables in .df that are not in .within.

.within

Quotes or unquoted variable(s) that the .var variables should be consistent within.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# In the Scorecard data, it should be the case that
# state_abbr and inst_name never change within university.
# Let's see if that's true
data(Scorecard)
fixed_check(Scorecard, .var = c(state_abbr, inst_name), .within = unitid)
# it returns TRUE! We're good to go

# count_not_working has no reason to be constant within unitid,
# but let's see what happens if we run it through
fixed_check(Scorecard, .var = count_not_working, .within = unitid)
# It gives back a tibble with inconsistent obs!

pmdplyr documentation built on July 2, 2020, 4:08 a.m.