write.dta {misty} | R Documentation |
Write Stata DTA File
Description
This function writes a data frame or matrix into a Stata data file.
Usage
write.dta(x, file = "Stata_Data.dta", version = 14, label = NULL,
str.thres = 2045, adjust.tz = TRUE, check = TRUE)
Arguments
x |
a matrix or data frame to be written in Stata, vectors are coerced to a data frame. |
file |
a character string naming a file with or without file extension
'.dta', e.g., |
version |
Stats file version to use. Supports versions 8-15. |
label |
Sataset label to use, or |
str.thres |
any chracter vector with a maximum length greater than
|
adjust.tz |
this argument controls how the timezone of date-time values
is treated when writing, see 'Details' in the
in the |
check |
logical: if |
Note
This function is a modified copy of the read_dta()
function in the
haven package by Hadley Wickham, Evan Miller and Danny Smith (2023).
Author(s)
Hadley Wickham, Evan Miller and Danny Smith
References
Wickham H, Miller E, Smith D (2023). haven: Import and Export 'SPSS', 'Stata' and 'SAS' Files. R package version 2.5.3. https://CRAN.R-project.org/package=haven
See Also
read.dta
, write.sav
, write.mplus
,
write.xlsx
Examples
## Not run:
# Example 1: Write data frame 'mtcars' into the State data file 'mtcars.dta'
write.dta(mtcars, "mtcars.dta")
## End(Not run)