[STATSGRASS] Re: Connecting to databases on Windows using R

Roger Bivand Roger.Bivand at nhh.no
Fri Mar 18 03:01:04 EST 2005


On Thu, 17 Mar 2005, Teague O'Mara wrote:

> I followed the directions from bioconductor FAQ/Windows section and using
> getBioC was able to get Rbdi again, but RdbiPgSQL isn't appearing (or
> Rdbi.PgSQL).  It will open the site and load everything else that I want/need,
> but RdbiPgSQL isn't to be found.  
> 
> R returns the message:
> Unable to locate the requested package(s) in any known repository
> 
> getBioC("database") should be loading Rdbi and RdbiPgSQL, but when I try to call
> them up through R, Rdbi will work, but RdbiPgSQL isn't in the library.  
> 
> Using install.packages2("RdbiPgSQL") gets the same response: it can't find the
> package.
> 

It is only available as a source package, which needs to be built from 
source locally, linked against the local versions of the PostgreSQL 
libraries. I think Markus is not using Windows.

> I also tried to install RMySQL, which is supposed to be supported for R on
> Windows, but isn't in the CRAN repository.
> 

Correct, but visit CRAN, for example:

http://cran.r-project.org/bin/windows/contrib/2.0/

and read the ReadMe:

"...
Although the packages
  RMySQL, ROracle, and snow
pass make check, it seems to be dangerous to distribute them:
I do not have the software available these packages depend on.
RMySQL is available at http://stat.bell-labs.com/RS-DBI/download,
provided by its maintainer, David A. James."

It's the same thing, you can't automate the building of package binaries 
that depend on possibly varying external headers and libraries.

Roger


> Teague
> 
> 
> 
> Quoting Craig Aumann <caumann at ualberta.ca>:
> 
> > What the heck is install.packages2?? And where does one get it? 
> > 
> > On Thu, 2005-03-17 at 15:14, Markus Neteler wrote:
> > > OK, found something:
> > > 
> > > install.packages2("Rdbi")
> > > install.packages2("RdbiPgSQL")
> > > 
> > > seems to do the trick (was looking at getBioC.R).
> > > 
> > > Then I also found:
> > >  http://www.bioconductor.org/data/downloading.html
> > > 
> > > I'll update my docs tomorrow after another test (or your
> > > confirmation).
> > > 
> > > Markus
> > > 
> > > On Thu, Mar 17, 2005 at 01:54:10PM -0700, Craig Aumann wrote:
> > > > 
> > > > Well I'm curious to know what R on Windows actually does with the
> > > > following commands:
> > > > 
> > > >
> >
> install.packages(contriburl="http://www.bioconductor.org/repository/devel/package/Source/","Rdbi")
> > > >
> >
> install.packages(contriburl="http://www.bioconductor.org/repository/devel/package/Source/","RdbiPgSQL")
> > > > 
> > > > Does it successully install the packages, or complain loudly?
> > > > 
> > > > 
> > > > On Thu, 2005-03-17 at 13:30, Markus Neteler wrote:
> > > > > Hi 
> > > > > 
> > > > > (for me) it's strange that Rdbi doesn't appear on CRAN but
> > > > > I was already notified once not to discuss Rdbi questions on 
> > > > > the R Mailing lists... (so better to ask here :-)
> > > > > 
> > > > > Anyway, I have compiled some usage instructions here:
> > > > >  http://grass.itc.it/statsgrass/r_and_dbms.html
> > > > > which should be more or less still valid. 
> > > > > 
> > > > > Maybe a bit helpful, also comparing speed of Rdbi and RODBC.
> > > > > However, it doesn't cover MS-Win installation...
> > > > > 
> > > > > Best
> > > > > 
> > > > >  Markus
> > > > > 
> > > > > On Thu, Mar 17, 2005 at 11:33:02AM -0700, Craig Aumann wrote:
> > > > > > See Teague's question below.  As a linux person, I don't know
> > the answer
> > > > > > to this so am forward this message to the list.  
> > > > > > 
> > > > > > Having looked also at  http://www.bioconductor.org/ - which
> > links off of
> > > > > > the main R web page, I see a Windows version of Rdbi (click
> > "What is
> > > > > > Bioconductor"  and scroll down till you find the heading:
> > "Database
> > > > > > Interaction").  I'm seeing a RDBI for Windows, but no windows
> > version of
> > > > > > RdbiPgsql which is a problem! 
> > > > > > 
> > > > > > Have you tried sending a message to the R-Help list about this -
> > how do
> > > > > > windows users access PGSQL databases from R?  (R website ->
> > mailing
> > > > > > lists.)  
> > > > > > 
> > > > > > On the CRAN site, just searching databases, I saw the
> > following:
> > > > > > DBI, RMySQL, RODBC, ROracle. Not sure if windows versions exist
> > for any
> > > > > > of these.   
> > > > > > 
> > > > > > Also have a look at the links in
> > > > > > http://cran.r-project.org/doc/manuals/R-data.html .  
> > > > > > 
> > > > > > Afraid that's all I know about attaching to Databases on Windows
> > - which
> > > > > > ain't much I'm afraid. 
> > > > > > 
> > > > > > Cheers!
> > > > > > Craig
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > On Thu, 2005-03-17 at 10:40, Teague O'Mara wrote:
> > > > > > > Hi Craig.  I came back across this email from awhile ago.  I'm
> > attempting to
> > > > > > > look at cluster of points in GRASS and have been using the
> > script that Michael
> > > > > > > Barton wrote, but I'd like to look at a few other things and
> > it seems that using
> > > > > > > R and my GRASS data will be much easier. I have been using R
> > for basic
> > > > > > > statistics, but am far from being fluent with it.  If you have
> > a moment, can you
> > > > > > > help me out with some R issues?  I'm using an XP machine with
> > R 2.0.1.
> > > > > > > 
> > > > > > > I'm having a problem downloading and installing Rdbi and
> > RdbiPgSQL.  I can't
> > > > > > > find these two sets, or any SQL interface that will download
> > from CRAN.  I was
> > > > > > > able to download these directly from sourcforge (tar.gz
> > format), but I'm not
> > > > > > > sure what to do with them now.  Is it an issue with this
> > version of R?
> > > > > > > 
> > > > > > > Thanks for any help you can offer.
> > > > > > > 
> > > > > > > Cheers--
> > > > > > > Teague
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > Teague O'Mara
> > > > > > > Department of Anthropology
> > > > > > > Arizona State University
> > > > > > > Box 872402
> > > > > > > Tempe, AZ 85287-2402
> > > > > > > 480.965.6213
> > > > > > > 
> > > > > > > 
> > > > > > > Quoting Craig Aumann <caumann at ualberta.ca>:
> > > > > > > 
> > > > > > > > In glancing at your script, I wondered why you didn't just
> > import the
> > > > > > > > stuff into a statistical package like R and then use all
> > the
> > > > > > > > clustering
> > > > > > > > routines it has.    See www.r-project.org
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > ## Key commands in R are:
> > > > > > > > 
> > > > > > > > ## Load the packages to access the database, in particular
> > the PgSQL
> > > > > > > > ##
> > > > > > > > database
> > > > > > > > require(Rdbi)
> > > > > > > > require(RdbiPgSQL)
> > > > > > > > 
> > > > > > > > ## Load some clustering routines
> > > > > > > > 
> > > > > > > > require(cluster)
> > > > > > > > require(mclust)
> > > > > > > > 
> > > > > > > > 
> > > > > > > > ### Connect to the database and read in a points data set
> > "jogis"
> > > > > > > > ## and read in the dataset "wells_att".  
> > > > > > > > 
> > > > > > > > 
> > > > > > > > conn <- dbConnect(PgSQL(), dbname="jogis", user="caumann")
> > > > > > > > wells <- dbReadTable(conn, "wells_att")
> > > > > > > > dbDisconnect(conn)
> > > > > > > > 
> > > > > > > > ## Now you can apply any clustering or kernel smoothing
> > technique you
> > > > > > > > want to the dataset.  
> > > > > > > > 
> > > > > > > > If this is of any help, let me know and I can provide more
> > details.  
> > > > > > > > Cheers!
> > > > > > > > Craig
> > > > > > > > 
> > > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > 
> > > > > > _______________________________________________
> > > > > > statsgrass mailing list
> > > > > > statsgrass at grass.itc.it
> > > > > > http://grass.itc.it/mailman/listinfo/statsgrass
> > 
> > _______________________________________________
> > statsgrass mailing list
> > statsgrass at grass.itc.it
> > http://grass.itc.it/mailman/listinfo/statsgrass
> > 
> 
> 
> 
> Teague O'Mara
> Department of Anthropology
> Arizona State University
> Box 872402
> Tempe, AZ 85287-2402
> 480.965.6213
> 
> _______________________________________________
> statsgrass mailing list
> statsgrass at grass.itc.it
> http://grass.itc.it/mailman/listinfo/statsgrass
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no




More information about the grass-stats mailing list