write_secuTrial {secuTrialR} | R Documentation |
Write secuTrial exports to other formats
Description
Convert the export prepared in R and export it to SPSS (sav), Stata (dta) or SAS (xpt version 8) using the haven package.
Usage
write_secuTrial(object, ...)
## S3 method for class 'secuTrialdata'
write_secuTrial(object, format = "dta", metadata = FALSE, ...)
## S3 method for class 'data.frame'
write_secuTrial(object, filename, path = "", format = "dta", ...)
Arguments
object |
|
... |
further parameters |
format |
format in which to save the export (one of "dta", "sav", "xpt") |
metadata |
if TRUE then metadate files will also be written |
filename |
file name |
path |
directory where the files should be saved |
Details
Due to variable naming limitations in other packages, date variables are
appended with _d (rather than _date), datetime/POSIX variables are appended
with _dt (rather than _datetime) and factors with _f (rather than _factor).
Further variable names may be altered in the conversion process.
For details please refer to the haven
documentation.
Value
a list of filenames
Examples
# prepare path to example export
export_location <- system.file("extdata", "sT_exports", "lnames",
"s_export_CSV-xls_CTU05_long_ref_miss_en_utf8.zip",
package = "secuTrialR")
# load all export data
sT_export <- read_secuTrial(data_dir = export_location)
tdir <- tempdir()
write_secuTrial(sT_export, format = "dta", path = tdir)
list.files(tdir)
[Package secuTrialR version 1.3.3 Index]