R/check.R
check_dua_restrictions.Rd
Once the DUA crosswalk and level have been set, a working data
frame can be checked against active data element restrictions. The
data frame must pass before it can be writen using
write_dua_df()
.
check_dua_restrictions(df)
df | Data frame to check against set DUA restriction level. |
---|
## -------------- ## Setup ## -------------- ## set DUA crosswalk dua_cw <- system.file('extdata', 'dua_cw.csv', package = 'duawranglr') set_dua_cw(dua_cw)#>#>## read in data admin <- system.file('extdata', 'admin_data.csv', package = 'duawranglr') df <- read_dua_file(admin) ## -------------- ## set restriction level set_dua_level('level_iii') ## show restrictions see_dua_level(show_restrictions = TRUE)#>#>#>#> #>#>#>#>#>#>#> [1] "sid" "sname" "dob" "gender" "raceeth" "tid" "tname" #> [8] "zip" "mathscr" "readscr"## remove restrictive variables df <- dplyr::select(df, -c(sid,sname,tname)) ## confirm check_dua_restrictions(df)#>#>