[R] -newbie | RODBC import query
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Apr 4 19:10:50 CEST 2006
Here is real example anyone can use since it ships with R.
library(RODBC)
con <- odbcConnectDbase(system.file("files", "sids.dbf", package="foreign"))
tmp <- sqlFetch(con, "sids")
close(con)
As I have written before, ".dbf" is not well-defined, and it depends on
Microsoft's driver and your database agreeing on the format.
On Tue, 4 Apr 2006, Jeff Newmiller wrote:
> Evan Cooch wrote:
>
> [...]
>
>> OK, so after a bit of reading, seems I need to use RODBC (I'm using
>> [R] 2.2.1 for Windows, at the moment). But, I can't seem to figure
>> out the basics. Suppose the file I need to 'work with' is
>> test.dbf So, I try the following:
>>
>> library(RODBC);
>> import_dat <- odbcConnectDbase("c:\documents and
>> settings\egc\desktop\test.dbf")
>
> [...]
>
>> Suggestions? Apologies if this is easy, or (worse) and FAQ.
>
> Without test data, I can't say much. I don't use DBF very often
> anymore, but I do use ODBC, and I always use ODBC Administrator
> in the Control Panel to setup a DSN before using a data source.
> Something to try, anyway. I suspect you won't want to give any hints
> to R about "Dbase" if you have to do that... it should be treated
> as a generic data source.
Whyever advise against the information given in the package?
--
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 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list