Skip to contents

Writes the data and metadata from an ev_data container to the specified file format.

Usage

write_ev_data(
  ev_data,
  path,
  name = "ev_data",
  format = "stata",
  metadata = FALSE
)

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.

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
)

} # }