Learn R Programming

foreign (version 0.2-8)

read.dta: Read Stata binary files

Description

Reads a file in Stata v6.0 or v5.0 binary format into a dataframe.

Usage

read.dta(filename)

Arguments

filename
a filename as a character string

Value

  • a data frame

Details

The variables in the Stata data set become the columns of the data frame. Missing values are correctly handled. The data label, variable labels, and timestamp are stored as attributes of the data frame. Nothing is done with variable characteristics, print formats, or value labels.

References

Stata Users Manual describes the format of the files

See Also

write.dta,attributes

Examples

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

Run the code above in your browser using DataLab