write.dta {foreign}R Documentation

Write files in Stata binary format

Description

Writes the data frame to file in the Stata v6.0 binary format. Does not write matrix variables.

Usage

write.dta(dataframe, filename)

Arguments

dataframe a data frame
filename character string giving filename

Details

The columns in the data frame become variables in the Stata data set. Missing values are correctly handled. Nothing is done with factor levels, which should end up as variable labels.

Value

NULL

Author(s)

Thomas Lumley

References

Stata v6.0 Users Manual describes the file format

See Also

read.dta,attributes

Examples

data(swiss)
write.dta(swiss,swissfile<-tempfile())
read.dta(swissfile)