Initial function to read in and set the working DUA crosswalk.

set_dua_cw(
  dua_cw,
  delimiter = NULL,
  sheet = NULL,
  ignore_columns = NULL,
  remap_list = NULL
)

Arguments

dua_cw

Data frame object or file with columns representing security levels (header equalling name of level) and rows in each column representing restricted variables

delimiter

Set the delimiter if reading in a delimited file that is neither a comma separated value (CSV) nor tab separated value (TSV).

sheet

Set the sheet name or number if reading in a DUA crosswalk from Excel file with values not on the first sheet.

ignore_columns

(Experimental) Columns to ignore when reading in DUA crosswalk.

remap_list

(Experimental) If raw variable names should be remapped to new names, provide list with mappings from old names column to new names column.

Details

The crosswalk file can be in a variety of formats. It will be read automatically without additional arguments if it's in the following formats:

  • R: *.rdata, *.rda, *.rds

  • delimited: if *.csv or *.tsv

  • Stata: *.dta

  • SAS: *.sas7bdat

  • SPSS: *.sav

  • Excel: *.xls, *.xlsx if on first sheet

If a delimited file other than comma- or tab-separated values or an Excel file with information on a sheet other than the first, use the appropriate arguments to set that correct values.

Examples

## path to DUA crosswalk file dua_cw <- system.file('extdata', 'dua_cw.csv', package = 'duawranglr') ## set DUA restrictions using crosswalk file set_dua_cw(dua_cw)
#> -- duawranglr note ------------------------------------------------------------- #> DUA crosswalk has been set!
if (FALSE) { ## set using crosswalks stored in other file types set_dua_cw('dua_cw.dta') set_dua_cw('dua_cw.txt', delimiter = '|') set_dua_cw('dua_cw.csv', remap_list = list('level_i_new' = 'level_i_old')) }