write.dta | R Documentation |
This function writes a data frame or matrix into a Stata data file.
write.dta(x, file = "Stata_Data.dta", version = 14, label = NULL,
str.thres = 2045, adjust.tz = TRUE, check = TRUE)
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 |
dataset label to use, or |
str.thres |
any character 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 |
This function is a modified copy of the read_dta()
function in the
haven package by Hadley Wickham, Evan Miller and Danny Smith (2023).
Hadley Wickham, Evan Miller and Danny Smith
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
read.dta
, write.sav
, write.mplus
,
write.xlsx
## Not run:
# Example 1: Write data frame 'mtcars' into the State data file 'mtcars.dta'
write.dta(mtcars, "mtcars.dta")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.