简体   繁体   中英

How to load subset of dta/Stata file with R

Coming from Stata this seems to be an easy thing, though I cannot find a solution with R, though I read How to read a subset of large dataset in R?

Is it possible as it is in Stata to name the variables from a dataset I need and load just them? Is it then possible to name again specific variables from another data set and merge them?

I haven't tested it myself, but the latest version of the readstata13 package seems to allow for subsetting on both columns and rows:

read.dta13(file, convert.factors = TRUE, 
           generate.factors = FALSE, encoding = "UTF-8", 
           fromEncoding = NULL, convert.underscore = FALSE, 
           missing.type = FALSE, convert.dates = TRUE, 
           replace.strl = TRUE, add.rownames = FALSE, 
           nonint.factors = FALSE, select.rows = NULL, 
           select.cols = NULL, strlexport = FALSE, 
           strlpath = ".")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM