Description Usage Arguments Details Examples
This function is a wrapper for that will read a variety of file
types. The primary reason to use it rather than base R or tidyverse
functions is that every new file read will reset the
check_pass
environment variable to FALSE
. This is a
security feature in that it requires a new data check each time a
new file is read into memory.
1 |
file |
File name to be read into memory |
... |
Arguments to pass to read function based on the input type; see details for more information. |
The following input types are supported (with the underlying read function and default arguments accompanying):
rds: readRDS()
rdata: load()
csv: readr::read_delim(...,row.names = FALSE, sep = ,)
tsv: read::read_delim(...,row.names = FALSE, sep = '\t')
delimited: readr::read_delim(...,row.names = FALSE)
excel: read_xl::read_excel(...,sheet = 1)
stata: haven::read_dta()
sas: haven::read_sas()
spss: haven::read_sav()
All arguments for these internal write functions, including those
with default values, can be modified by adding them to the
top-level read_dua_file()
function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## --------------
## Setup
## --------------
## set DUA crosswalk
dua_cw <- system.file('extdata', 'dua_cw.csv', package = 'duawranglr')
set_dua_cw(dua_cw)
## --------------
## read in data
file <- system.file('extdata', 'admin_data.csv', package = 'duawranglr')
df <- read_dua_file(file)
## show
df
## Not run:
## read in other file types
read_dua_file('admin_data.rds')
read_dua_file('admin_data.txt', sep = '|')
read_dua_file('admin_data.dta')
read_dua_file('admin_data.xlsx', sheet = 2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.