[R] RODBC for importing dbf
ripley at stats.ox.ac.uk
Fri May 10 15:06:58 CEST 2002
On Fri, 10 May 2002, juli g. pausas wrote:
> 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")
>  "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.
[Not reading the documentation, not even the help page for odbcConnect.]
ODBC does not open files. It connects to databases as specified by DSNs.
The first argument of odbcConnect is `dsn', documented as
dsn: character. A registered data source name.
See the R Data Import/Export Manual and your Windows documentation for how
to configure ODBC sources in the ODBC Control Panel Applet. Hopefully you
will have one or more ODBC drivers for `dbf files'.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
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