Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
foreignR
doInstall <- TRUE
toInstall <- c("foreign")
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
#http://cran.r-project.org/web/packages/foreign/foreign.pdf
#setwd("your working directory here")
library(foreign)
STATA <- read.dta("stata.dta")
head(STATA)
table(STATA$region)
STATA <- read.dta("stata.dta", convert.factors=FALSE)
head(STATA)
STATA <- read.dta("stata.dta", convert.factors=FALSE, convert.underscore=TRUE)
head(STATA)
table(STATA$region)
write.dta(STATA, "fromR.dta")
write.dta(STATA, "fromRfactors.dta", convert.factors="labels")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.