writeSafeFile: writeSafeFile

View source: R/GUIfunctions.R

writeSafeFileR Documentation

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

a 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 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 utils::write.table() if argument "format" equals "csv"

Value

invisible NULL if the file was successfully written

Author(s)

Bernhard Meindl


sdcTools/sdcMicro documentation built on March 15, 2024, 12:32 p.m.