Read dBase / Paradox data into R?

房东的猫 提交于 2019-12-24 14:15:35

问题


I have a hundred or so database files I inherited that I'm currently reading with "Paradox dBase Access Reader", and exporting manually to pipe-delimited text files. I'd LOVE to do this with some kind of access library that would let me read these files directly into R.

The reader tool states that these files are "Paradox 5.0 for Windows", and they have a .db extension on them.

I was hopeful that I could use the foreign package to read them, because it states in the docs for the read.dbf() function:

DBF is the extension used for files written for the ‘XBASE’ family of database languages, covering the dBase, Clipper, FoxPro, and their Windows equivalents Visual dBase, Visual Objects, and Visual FoxPro, plus some older products’

Unfortunately, it fails in the DBFOpen C function, at around line 425:

if( fread( pabyBuf, nHeadLen-32, 1, psDBF->fp ) != 1 )
{
  fclose( psDBF->fp );
  free( pabyBuf );
  free( psDBF );
  return NULL;
}

Anyone have other solutions, or insight into whether read.dbf() is a good or bad match here?


回答1:


A search for "paradox db" on rseek.org yields the gnumeric package, which says it can read Paradox files. I don't have any way to test that functionality, but it just might work...




回答2:


The list does not mention Paradox 5.0 explicitely, Your effort to read it using read.dbf failed. It the files are static, i.e. not changing anymore, I would just create a script to export them once, read them into R, and dump the result using save this way you can just read the data into R using load.

If the data is not too big, this will be a quick process, and allowing you to easily read all the data and extract any subset you like. If it is big, you could invest some time to dump the files into a more modern database, e.g. sqlite (although this is not a full blown database, it is nice and lightweight). I wouldn't invest too much time in gaining direct access from R to these ancient files if it is not strictly necessary...



来源:https://stackoverflow.com/questions/14837414/read-dbase-paradox-data-into-r

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