R: How to quickly read large .dta files without RAM Limitations

前端 未结 2 1075
执笔经年
执笔经年 2021-01-06 04:55

I have a 10 GB .dta Stata file and I am trying to read it into 64-bit R 3.3.1. I am working on a virtual machine with about 130 GB of RAM (4 TB HD) and the .dta file is abou

2条回答
  •  鱼传尺愫
    2021-01-06 05:22

    I recommend the haven R package. Unlike foreign, It can read the latest Stata formats:

    library(haven)
    data <- read_dta('myfile.dta')
    

    Not sure how fast it is compared to other options, but your choices for reading Stata files in R are rather limited. My understanding is that haven wraps a C library, so it's probably your fastest option.

提交回复
热议问题