writes an anonymized dataset to a file. This function should be used in the
graphical user interface sdcApp()
only.
writeSafeFile(obj, format, randomizeRecords, fileOut, ...)
invisible NULL
if the file was successfully written
a data.frame
containing micro data
(character) specifies the output file format. Accepted values are:
"rdata"
: output will be saved in the R binary file-format
"sav"
: output will be saved as SPSS-file
"dta"
: ouput will be saved as STATA-file
"csv"
: output will be saved as comma seperated (text)-file
"sas"
: output will be saved as SAS-file (sas7bdat)
(logical) specifies, if the output records should be randomized. The following options are possible:
"no"
: default, no randomization takes place
"simple"
: records are randomly swapped
"byHH"
: if slot "hhId"
is not NULL
, the clusters defined by this
variable are randomized across the dataset. If slot "hhId"
is NULL
, the
records or the dataset are randomly changed.
"withinHH"
: if slot "hhId"
is not NULL
, the clusters defined by
this variable are randomized across the dataset and additionally, the order
of records within the clusters are also randomly changed. If slot "hhId"
is NULL
, the records or the dataset are randomly changed.
(character) file to which output should be written
optional arguments used for utils::write.table()
if
argument "format"
equals "csv"
Bernhard Meindl