Exports synthetic data set(s) from synthesised data set
(synds
) object to external files of selected format.
Currently supported file formats include: SPSS, Stata, SAS, csv, tab,
rda, RData and txt. For SPSS, Stata and SAS it uses functions from
the foreign
package with some adjustments where necessary.
Information about the synthesis is written into a separate text file.
NOTE: Currently numeric codes and labels can be preserved correctly only
for SPSS files imported into R using read.obs
function.
write.syn(object, filename,
filetype = c("csv", "tab", "txt",
"SPSS", "Stata", "SAS", "rda", "RData"),
convert.factors = "numeric", data.labels = NULL, save.complete = TRUE,
extended.info = TRUE, ...)
File(s) with synthesised data set(s) and a text file with information
about synthesis are produced. Optionally a complete synthesised data set
object is saved into synobject_filename.RData
file.
an object of class synds
, which stands
for 'synthesised data set'. It is typically created by
function syn
and it includes object$m
synthesised data set(s).
the name of the file (excluding extension) which the
synthetic data are to be written into. For multiple synthetic data sets
it will be used as a prefix folowed respectively by _1
, _...
,
_m
.
a desired format of the output files.
a single string indicating how to handle factors in
Stata output files. The default value is set to "numeric"
in order
to preserve the numeric codes from the original data.
See write.dta
for other possible values.
a list with variable labels and value labels.
a logical value indicating whether a complete
'synthesised data set' (synds
) object should be saved into a file
(synobject_filename.RData
).
a logical value indicating whether extended information should be saved into an information file.
additional parameters passed to write functions.
read.obs