title: Haven: read_dta error() "Failed to parse /Users/folder/my_data.dta: Unable to allocate memory."
body: <p>I have a relatively large <code>.dta</code> file, with 1280000 observations, that works fine in Stata, but I am having troubles importing it into R.
  The data was created with Stata 15, the data contains strL or str#, #&gt;244 variables and cannot be saved in the Stata 12 format.</p>
  <p>I am trying to use the <code>haven</code> package to import the saved data using <code>read_dta()</code> but it is giving me the following error message: <code>&quot;Failed to parse /Users/folder/my_data.dta: Unable to allocate memory.&quot;</code>
  Does anyone know what might be causing this problem and how to overcome it to be able to import the data in R?</p>
  <p>I have attempted to overcome the issue in multiple ways, but none of my attempts appears to work.</p>
  <ol>
  <li><p>First I tried to expand the memory size of my r environment using <code>Sys.setenv('R_MAX_VSIZE'=32000000000)</code> but the console reports the same error when I try to import the data. The problem does not appear to relate to the size of my memory in R.</p>
  </li>
  <li><p>I tried to save the data in Stata 13 format, using <code>saveold my_data13, version(13)</code> in Stata, but trying to import it into R with <code>haven</code> still produces the same error message.</p>
  </li>
  <li><p>I tried to use readstata13 function <code>read.dta13(my_data13)</code>, but this regularly end up in R crashing.</p>
  </li>
  </ol>
  <p>The strange thing is that I am able to open the data correctly in Stata, by simply double-clicking on it.</p>
  <p>Does anyone has any suggestion on how to address this issue? Any insight on a) the meaning of the error message and how to address it 2) alternative packages able to ope stata15 files c) approach to be able to open the data in R would be most welcome.</p>
  <p>Thanks a lot in advance for your help</p>
  <p>Best Regards</p>