Write data files
write_ev_data.Rd
Writes the data and metadata from an ev_data
container to the specified file format.
Arguments
- ev_data
An
ev_data
container- path
Path to the folder to save files to
- name
(default='ev_data') A name for the data request. Used as the prefix for every output file.
- format
(default='stata') File format to write to. One of
c('stata', 'csv')
.- metadata
(default=FALSE) If
TRUE
, also output files for variable, category and table metadata.
See also
Other data request functions:
ev_simple_fetch()
,
fetch_ev_data()
,
fetch_ev_meta_tabs()
,
fetch_ev_meta_vars()
,
make_ev_variables()
,
read_ev_variables()
Examples
if (FALSE) { # \dontrun{
con <- ev_connect()
# read a variable data request file
vars <- read_ev_variables("path/to/variables/file")
# fetch the data from EpiVault
ev <- fetch_ev_data(con, vars)
# write the data files in default stata format, excluding metadata
write_ev_data(ev_data = ev,
path = "path/to/data/request/folder",
name = "request101"
)
# write the data files in csv format, including metadata
write_ev_data(ev_data = ev,
path = "path/to/data/request/folder",
name = "request101",
format = 'csv',
metadata = TRUE
)
} # }