processVISION: Process a VISION XML file from their EDC

Description Usage Arguments Value See Also Examples

View source: R/processVISION.R

Description

This function takes in a XML and creates a list of R data.frames

Usage

1
2
3
4
processVISION(xmlfile, isXML = FALSE, drop.dsets = NULL,
  keep.dsets = NULL, dset.names = NULL, verbose = TRUE,
  drop.pattern = NULL, keep.pattern = NULL, drop.new = TRUE,
  fast = TRUE, homogeneous = NA, writedta = FALSE, ...)

Arguments

xmlfile

XML filename from VISION EDC, or if xmlParse has already been run, then the XML document with class XMLAbstractDocument. if (isXML = FALSE), should have ".xml" extension not ".zip".

isXML

(logical) indicating whether xml is an XMLAbstractDocument class (TRUE), or a filename (default FALSE)

drop.dsets

vector of dataset names that can be dropped (NULL)

keep.dsets

vector of dataset names that are to be kept (NULL)

dset.names

vector of dataset names to match (after dropping drop.dsets) if these do not match EXACTLY (case) the dataset names (all of them), this will error (NULL)

verbose

logical - Progress printed?(TRUE)

drop.pattern

vector of regular expression that will drop datasets that contain patterns using grep

keep.pattern

vector of regular expression that will keep only datasets that contain any of the patterns grep

drop.new

(logical) should records be dropped with a "New" formState (default TRUE)

fast

(logical) if TRUE (default), will use xmlToDF (usually faster) to convert XML to data.frame. If FALSE, will use xmlToDataFrame

homogeneous

(logical) should xmlToDataFrame assume each node has all the variables (default TRUE), note this is different than default for xmlToDataFrame

writedta

(logical) should the dta be written for each dataset? (default FALSE)

...

arguments to be passed to create_stata_dta

Value

A list with slots df.list, the list of datasets, datetime, the date/time the data was exported according to the XML, dsets, the dataset names, should match names(df.list), and runtimes, a list of system.time objects recorded how long it took to convert to data.frame from XML.

See Also

xmlParse, xmlRoot

Examples

1
2
3
4
5
6
7
## Not run: 
xmlfile = "MISTIE_III_Subjects_2014_01_09.xml"
df <- processVISION(xmlfile, isXML=FALSE, 
drop.pattern=c("^i_Doc_.*", "^docs_.*"),
drop.new=TRUE)

## End(Not run)

muschellij2/processVISION documentation built on May 23, 2019, 9:54 a.m.