How to load subset of dta/Stata file with R

拟墨画扇 提交于 2020-01-06 03:17:04

问题


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?


回答1:


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 = ".")


来源:https://stackoverflow.com/questions/38104372/how-to-load-subset-of-dta-stata-file-with-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!