write.syn {synthpop} | R Documentation |
Exporting synthetic data sets to external files
Description
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.
Usage
write.syn(object, filename,
filetype = c("SPSS", "Stata", "SAS", "csv", "tab", "rda", "RData", "txt"),
convert.factors = "numeric", data.labels = NULL, save.complete = TRUE,
extended.info = TRUE, ...)
Arguments
object |
an object of class |
filename |
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 |
filetype |
a desired format of the output files. |
convert.factors |
a single string indicating how to handle factors in
Stata output files. The default value is set to |
data.labels |
a list with variable labels and value labels. |
save.complete |
a logical value indicating whether a complete
'synthesised data set' ( |
extended.info |
a logical value indicating whether extended information should be saved into an information file. |
... |
additional parameters passed to write functions. |
Value
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.