create_stata_dta: Process a list of data.frames from processVISION into .dta...

Description Usage Arguments Value See Also Examples

View source: R/create_stata_dta.R

Description

Processes a list of data.frames and uses write32.dta to create Stata data sets, converting factor and character vectors of each column of each dataset

Usage

1
2
3
create_stata_dta(df.list, outdir = ".", date = NULL, lower.names = FALSE,
  tryConvert = TRUE, version = 11L, convert.dates = TRUE,
  convert.factors = "string", verbose = TRUE, trunc32 = FALSE, ...)

Arguments

df.list

list of data frames from processVISION

outdir

directory to put Stata .dta files (default ".")

date

(character, default NULL) date of export, to be added to names of datasets

lower.names

(logical, default FALSE) should the column names for each variable be lowercase?

tryConvert

(logical, default TRUE) should the function try to make Date and numeric columns (TRUE) or just leave the data.frame as is (FALSE)?

version

(integer, default 11L) version of Stata to create, passed to write.dta

convert.dates

(logical, default TRUE) convert the dates to Stata dates? see write.dta

convert.factors

(character, default "string") how to handle factors, see write.dta

verbose

(logical, default TRUE) should names be printed for checking the progress?

trunc32

Truncate variables with > 32 characters?

...

Additional arguments to be passed to write32.dta

Value

data.frame with 2 columns: the dataset name and an indicator if that dataset was converted.

See Also

write32.dta, write.dta, processVISION

Examples

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

## End(Not run)

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