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.[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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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. Thanks Juli -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._