Learn R Programming

sdcMicro (version 5.6.1)

writeSafeFile: writeSafeFile

Description

writes an anonymized dataset to a file. This function should be used in the graphical user interface sdcApp only.

Usage

writeSafeFile(obj, format, randomizeRecords, fileOut, ...)

Arguments

obj

an object of class data.frame containing micro data

format

(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).

randomizeRecords

(logical) specifies, if the output records should be randomized. The following options are possible:

  • 'no' default, no randomization takes place

  • 'simple' records are just 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.

fileOut

(character) file to which output should be written

...

optional arguments used for write.table if argument format equals csv

Author

Bernhard Meindl