Convert the export prepared in R and export it to SPSS (sav), Stata (dta) or SAS (sas, xpt version 8) using the haven package.
write_tsExport(object, ...)
# S3 method for class 'tsExportdata'
write_tsExport(object, format = "dta", metadata = FALSE, ...)
# S3 method for class 'data.frame'
write_tsExport(df, filename, path = "", format = "dta", ...)
a list of filenames
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 _cat (rather than _factor).
Further variable names may be altered in the conversion process.
For details please refer to the haven
documentation.
Since this has not been heavily tested or used there may be issues and you might prefer doing this manually
with the haven package. One particular sticking point is the length of variable names - R is not restrictive in
this respect, but other software can be. read_tsExport does not truncate names, prefering to leave this to the
user, which can cause write_tsExport() to fail with an error.
Conversion to SPSS, STATA, SAS https://github.com/SwissClinicalTrialOrganisation/secuTrialR/blob/master/R/write_secuTrial.R https://cran.r-project.org/web/packages/secuTrialR/vignettes/secuTrialR-package-vignette.pdf
if (FALSE) { # \dontrun{
# read ts data
EXPORT_DIR <- file.path("/path/to/transferstelle_export",
"export_directory")
# load all export data
tsExport <- read_tsExport(EXPORT_DIR, separator = ",", decimal = ".")
tdir <- tempdir()
write_tsExport(tsExport, format = "sav", path = tdir)
list.files(tdir)
} # }