write.amelia: Write Amelia imputations to file

Description Usage Arguments Details See Also

View source: R/write.amelia.R

Description

Writes the imptuted datasets to file from a run of amelia

Usage

1
2
write.amelia(obj, separate = TRUE, file.stem, extension = NULL,
  format = "csv", impvar = "imp", orig.data = TRUE, ...)

Arguments

obj

an object of class "amelia"; typically output from the function amelia

separate

logical variable. If TRUE (default), the imputed datasets will be written to separate files, whose names come from the file.stem and extension arguments. If FALSE, the imputations are stacked and written as a single file.

file.stem

the leading part of the filename to save to output The imputation number and extension will be added to complete the filename. This can include a directory path.

extension

the extension of the filename. This is simply what follows file.stem and the imputation number.

format

one of the following output formats: csv, dta or table. See details.

impvar

the name of imputation number variable written to the stacked dataset when separate is FALSE.

orig.data

logical variable indicating whether the original, unimputed dataset should be included in the stacked dataset when separate is FALSE.

...

further arguments for the write functions.

Details

write.amelia writes the imputed datasets to a file or a set of files using one of the following functions: write.csv, write.dta, or write.table. You can pass arguments to these functions from write.amelia.

When separate is TRUE, each imputed dataset is written to its own file. If you were to set file.stem to "outdata" and the extension to ".csv" , then the resulting filename of the written files will be

1
2
3
4
  outdata1.csv
  outdata2.csv
  outdata3.csv
  ...

and so on.

When separate is FALSE, the function adds a variable called impvar to each dataset which indicates the imputed dataset to which the row belongs. Then, each of the datasets are stacked together to create one dataset. If orig.data is TRUE, then the original, unimputed dataset is included at the top of the stack, with its imputation number set to 0.

See Also

write.csv, write.table, write.dta


Amelia documentation built on May 27, 2021, 1:06 a.m.