[R] RODBC for importing dbf

Petr Pikal petr.pikal at precheza.cz
Fri May 10 17:09:43 CEST 2002


On Fri, 10 May 2002, juli g. pausas wrote:

> Hi
> I know that it is very easy to import data from a dbf file to R, by
> saving the data as csv, for instance. However, I have several hundreds
> of files to do that. So, I thought of using RODBC to read the dbf files
> and save it as data.frame. However, I cannot even start (this is my
> first time using such package):
>
> > library(RODBC)
> > bdades <- odbcConnect("prova.DBF")
> Warning message:
> ODBC connection failed in: odbcConnect("prova.DBF")
> > dir(pattern="pr")
> [1] "prova.DBF"
>
> My idea was to use sqlFetch(bdades) to create an R data.frame.
> I'm using R on Windows. I can open the file prova.DBF with Excel without
> any problem. What I'm doing wrong? Any comment or suggestion will be
> welcome.

You have to go through documentation for RODBC thoroughly.

To use RODBC you need to do some preliminary setting in Windows Control 
Panel and only after that odbcConnect("file") opens a "connection" to a "file".

Than you can use sqlQuery or maybe some other commands to fetch your data to 
R.

But I am a little bit in doubt if it is the easiest way for importing data from several 
hundreds of files. 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.- r-help mailing list -- Read
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or
"[un]subscribe" (in the "body", not the subject !)  To:
r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
Petr Pikal
petr.pikal at precheza.cz
p.pik at volny.cz


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list