Re: [R] postgres
RPgSQL etc seem now to be unsupported. As for ODBC, there is some information in the README *but* setting up ODBC is not an R question. Once you have a working connection (tested by say isql -v foo), then odbcConnect("foo") will work too. There is lots of documentation on the unixODBC site. Where I would be critical is of the Postrgres ODBC documentation: there are several drivers, no documentation and most of them are broken. The one place you will find how to do it is in the RODBC README. So I do resent your comments. >From that README: One quirk to be watched is the use of connections to the DBMS via the Unix sockets vs ports. The PostgreSQL driver bundled with unixODBC will use Unix sockets to `localhost', but this driver seems unreliable (see the ChangeLog). The current driver will only use a TCP/IP port, and to use that needs postmaster started with the -i flag (which is not the default) and with tcp/ip enables in the configuration file (which is the default). The PostgreSQL drivers are seriously under-documented! On 11 Feb 2003, Joshua Gramlich wrote: > Right, but you see, I'm not trying to make a connection in R yet, I'm > trying to get the right tools installed. I have found zero coherent > documentation for any of this stuff. Yes, there's the import/export > guide, and that's helpful and all but it doesn't tell me what I need to > do with these files: > > DBI.RPgSQL_0.1-2.tar.gz > Rdbi_0.1-2.tar.gz > Rdbi.PgSQL_0.1-2.tar.gz > > None of these files contains any documentation either. > > ...now, when I go to > > http://rpgsql.sourceforge.net/ > > There's no documentation there either. In fact, there's only a message > saying that this project has been deprecated in favor of Rdbi. If you > click on the download link, you get an error from sourceforge, so you > cannot even get the code through the sourceforge website. If you go to > the Rdbi page, there isn't anything there either...and on the > sourceforge page the download is for version 0.1.2. > > ...and that just covers the postgres specific stuff. > > > As to how RODBC works, I don't know, because I haven't found any > documentation specifically about that either. Again, there's the > import/export guide, but that's only about how to use it, not how to get > one's system set up to use it. All I've figured out to do is run > "install.packages("RODBC")"...which begins the installation process, but > because the driver manager apparently isn't set up correctly, it tells > me I must install a driver manageror "no ODBC driver manager found". Quote from the README: The RODBC package is installed in the standard way (R CMD INSTALL RODBC) and needs the ODBC driver manager library (-lodbc or -lodbc32 or -liodbc) to be in the library search path (and library run path). It is just telling you that you have not done that > I have unixODBC installed... > > Ugh. I'm giving up on this for today. I just found out that there is > no odbc rpm for postgres 7.3.1, so i'm gonna have to go back to 7.2.4 to > get that functionality in rpm format...which means blowing out my > database...which means tomorrow. > > > Thanks for all the help so far folks. > > > Josh > Chicago > > > > > > > > On Tue, 2003-02-11 at 16:11, Jason W. Martinez wrote: > > Josh, > > > > It sounds like part of your problem is that you're not reading all of the > > documentation. The first step is to _understand_ what an ODBC Manager is AND > > what it is supposed to be doing. > > > > You have to configure your manager (among other things) before you can even > > begin to make a connection from R with (RODBC). > > > > Don't get discouraged. ODBC is beautiful thing! Further, I make connections > > with RODBC to postgresql databases all the time. It is possible, just be > > patient and read the docs. > > > > Jason > > > > On Tuesday 11 February 2003 01:48 pm, Joshua Gramlich wrote: > > > I'm actually looking at that exact page in the import/export manual > > > right now. I'm trying to install RODBC via CRAN, but I get this: > > > > > > blahblahblah... > > > checking for library containing SQLTables... no > > > configure: error: "no ODBC driver manager found" > > > ERROR: configuration failed for package 'RODBC' > > > > > > Delete downloaded files (y/N)? y > > > > > > Warning message: > > > Installation of package RODBC had non-zero exit status in: > > > install.packages("RODBC") > > > > > > > > > > > > I tried installing unixODBC, but that didn't seem to solve the problem. > > > > > > Thoughts? > > > > > > > > > > > > Josh > > > Chicago > > > > > > On Tue, 2003-02-11 at 15:31, John Fox wrote: > > > > Dear David and Joshua, > > > > > > > > One can also access PostgreSQL via the RODBC package. There's more > > > > information in section 4 of the R Data Import/Export manual, which is > > > > part of the R distribution and is also available on CRAN. > > > > > > > > John > > > > > > > > At 04:08 PM 2/11/
Re: [R] postgres
Right, but you see, I'm not trying to make a connection in R yet, I'm trying to get the right tools installed. I have found zero coherent documentation for any of this stuff. Yes, there's the import/export guide, and that's helpful and all but it doesn't tell me what I need to do with these files: DBI.RPgSQL_0.1-2.tar.gz Rdbi_0.1-2.tar.gz Rdbi.PgSQL_0.1-2.tar.gz None of these files contains any documentation either. ...now, when I go to http://rpgsql.sourceforge.net/ There's no documentation there either. In fact, there's only a message saying that this project has been deprecated in favor of Rdbi. If you click on the download link, you get an error from sourceforge, so you cannot even get the code through the sourceforge website. If you go to the Rdbi page, there isn't anything there either...and on the sourceforge page the download is for version 0.1.2. ...and that just covers the postgres specific stuff. As to how RODBC works, I don't know, because I haven't found any documentation specifically about that either. Again, there's the import/export guide, but that's only about how to use it, not how to get one's system set up to use it. All I've figured out to do is run "install.packages("RODBC")"...which begins the installation process, but because the driver manager apparently isn't set up correctly, it tells me I must install a driver manageror "no ODBC driver manager found". I have unixODBC installed... Ugh. I'm giving up on this for today. I just found out that there is no odbc rpm for postgres 7.3.1, so i'm gonna have to go back to 7.2.4 to get that functionality in rpm format...which means blowing out my database...which means tomorrow. Thanks for all the help so far folks. Josh Chicago On Tue, 2003-02-11 at 16:11, Jason W. Martinez wrote: > Josh, > > It sounds like part of your problem is that you're not reading all of the > documentation. The first step is to _understand_ what an ODBC Manager is AND > what it is supposed to be doing. > > You have to configure your manager (among other things) before you can even > begin to make a connection from R with (RODBC). > > Don't get discouraged. ODBC is beautiful thing! Further, I make connections > with RODBC to postgresql databases all the time. It is possible, just be > patient and read the docs. > > Jason > > On Tuesday 11 February 2003 01:48 pm, Joshua Gramlich wrote: > > I'm actually looking at that exact page in the import/export manual > > right now. I'm trying to install RODBC via CRAN, but I get this: > > > > blahblahblah... > > checking for library containing SQLTables... no > > configure: error: "no ODBC driver manager found" > > ERROR: configuration failed for package 'RODBC' > > > > Delete downloaded files (y/N)? y > > > > Warning message: > > Installation of package RODBC had non-zero exit status in: > > install.packages("RODBC") > > > > > > > > I tried installing unixODBC, but that didn't seem to solve the problem. > > > > Thoughts? > > > > > > > > Josh > > Chicago > > > > On Tue, 2003-02-11 at 15:31, John Fox wrote: > > > Dear David and Joshua, > > > > > > One can also access PostgreSQL via the RODBC package. There's more > > > information in section 4 of the R Data Import/Export manual, which is > > > part of the R distribution and is also available on CRAN. > > > > > > John > > > > > > At 04:08 PM 2/11/2003 -0500, David Forrest wrote: > > > >On 11 Feb 2003, Joshua Gramlich wrote: > > > > > Is anyone using R with postgres? I'd like to do so, but cannot seem > > > > > to find any reasonable explanation of how to do so. > > > > > > > > > > > > > > > Joshua Gramlich > > > > > Chicago, IL > > > > > > > >library(RPgSQL) # It isn't in an obvious place: > > > > # http://lib.stat.cmu.edu/R/CRAN/src/contrib/Devel > > > >db.connect() > > > >db.ls() > > > > > > > >Dave, > > > >-- > > > > Dave Forrest(434)924-3954w(111B) (804)642-0662h (804)695-2026p > > > > [EMAIL PROTECTED] http://mug.sys.virginia.edu/~drf5n/ > > > > > > - > > > John Fox > > > Department of Sociology > > > McMaster University > > > Hamilton, Ontario, Canada L8S 4M4 > > > email: [EMAIL PROTECTED] > > > phone: 905-525-9140x23604 > > > web: www.socsci.mcmaster.ca/jfox > > > - > > > > > > __ > > > [EMAIL PROTECTED] mailing list > > > http://www.stat.math.ethz.ch/mailman/listinfo/r-help > > > > __ > > [EMAIL PROTECTED] mailing list > > http://www.stat.math.ethz.ch/mailman/listinfo/r-help > > -- > Jason W. Martinez, Graduate student > Department of Sociology > University of California, Riverside > __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postgres
Josh, It sounds like part of your problem is that you're not reading all of the documentation. The first step is to _understand_ what an ODBC Manager is AND what it is supposed to be doing. You have to configure your manager (among other things) before you can even begin to make a connection from R with (RODBC). Don't get discouraged. ODBC is beautiful thing! Further, I make connections with RODBC to postgresql databases all the time. It is possible, just be patient and read the docs. Jason On Tuesday 11 February 2003 01:48 pm, Joshua Gramlich wrote: > I'm actually looking at that exact page in the import/export manual > right now. I'm trying to install RODBC via CRAN, but I get this: > > blahblahblah... > checking for library containing SQLTables... no > configure: error: "no ODBC driver manager found" > ERROR: configuration failed for package 'RODBC' > > Delete downloaded files (y/N)? y > > Warning message: > Installation of package RODBC had non-zero exit status in: > install.packages("RODBC") > > > > I tried installing unixODBC, but that didn't seem to solve the problem. > > Thoughts? > > > > Josh > Chicago > > On Tue, 2003-02-11 at 15:31, John Fox wrote: > > Dear David and Joshua, > > > > One can also access PostgreSQL via the RODBC package. There's more > > information in section 4 of the R Data Import/Export manual, which is > > part of the R distribution and is also available on CRAN. > > > > John > > > > At 04:08 PM 2/11/2003 -0500, David Forrest wrote: > > >On 11 Feb 2003, Joshua Gramlich wrote: > > > > Is anyone using R with postgres? I'd like to do so, but cannot seem > > > > to find any reasonable explanation of how to do so. > > > > > > > > > > > > Joshua Gramlich > > > > Chicago, IL > > > > > >library(RPgSQL) # It isn't in an obvious place: > > > # http://lib.stat.cmu.edu/R/CRAN/src/contrib/Devel > > >db.connect() > > >db.ls() > > > > > >Dave, > > >-- > > > Dave Forrest(434)924-3954w(111B) (804)642-0662h (804)695-2026p > > > [EMAIL PROTECTED] http://mug.sys.virginia.edu/~drf5n/ > > > > - > > John Fox > > Department of Sociology > > McMaster University > > Hamilton, Ontario, Canada L8S 4M4 > > email: [EMAIL PROTECTED] > > phone: 905-525-9140x23604 > > web: www.socsci.mcmaster.ca/jfox > > - > > > > __ > > [EMAIL PROTECTED] mailing list > > http://www.stat.math.ethz.ch/mailman/listinfo/r-help > > __ > [EMAIL PROTECTED] mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Jason W. Martinez, Graduate student Department of Sociology University of California, Riverside __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postgres
I'm actually looking at that exact page in the import/export manual right now. I'm trying to install RODBC via CRAN, but I get this: blahblahblah... checking for library containing SQLTables... no configure: error: "no ODBC driver manager found" ERROR: configuration failed for package 'RODBC' Delete downloaded files (y/N)? y Warning message: Installation of package RODBC had non-zero exit status in: install.packages("RODBC") > I tried installing unixODBC, but that didn't seem to solve the problem. Thoughts? Josh Chicago On Tue, 2003-02-11 at 15:31, John Fox wrote: > Dear David and Joshua, > > One can also access PostgreSQL via the RODBC package. There's more > information in section 4 of the R Data Import/Export manual, which is part > of the R distribution and is also available on CRAN. > > John > > At 04:08 PM 2/11/2003 -0500, David Forrest wrote: > >On 11 Feb 2003, Joshua Gramlich wrote: > > > > > Is anyone using R with postgres? I'd like to do so, but cannot seem to > > > find any reasonable explanation of how to do so. > > > > > > > > > Joshua Gramlich > > > Chicago, IL > > > >library(RPgSQL) # It isn't in an obvious place: > > # http://lib.stat.cmu.edu/R/CRAN/src/contrib/Devel > >db.connect() > >db.ls() > > > >Dave, > >-- > > Dave Forrest(434)924-3954w(111B) (804)642-0662h (804)695-2026p > > [EMAIL PROTECTED] http://mug.sys.virginia.edu/~drf5n/ > > - > John Fox > Department of Sociology > McMaster University > Hamilton, Ontario, Canada L8S 4M4 > email: [EMAIL PROTECTED] > phone: 905-525-9140x23604 > web: www.socsci.mcmaster.ca/jfox > - > > __ > [EMAIL PROTECTED] mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/r-help > __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postgres
> Is anyone using R with postgres? I'd like to do so, but cannot seem to > find any reasonable explanation of how to do so. Lots of us do. There is a confusingly wide selection of connection mechanisms available, I mostly stick with RODBC as I can then use the same code snippets under Windoze and Linux. But I also use the RPgSQL (sp?) module directly. Where exactly are you faltering? Dirk, also in Chicago -- According to the latest figures, 43% of all signatures are totally worthless. __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postgres
Yes, I do. Here's a code snippet that worked for me: library(RPgSQL) db.connect(dbname='fgdata') fgdata.df<-db.read.table('mlm_data') This assumes you have the RPgSQL library installed, and that you have postgres running on the local machine. There's more documentation in the RPgSQL package. Best, Andy Perrin -- Andrew J Perrin - http://www.unc.edu/~aperrin Assistant Professor of Sociology, U of North Carolina, Chapel Hill [EMAIL PROTECTED] * andrew_perrin (at) unc.edu On 11 Feb 2003, Joshua Gramlich wrote: > Is anyone using R with postgres? I'd like to do so, but cannot seem to > find any reasonable explanation of how to do so. > > > Joshua Gramlich > Chicago, IL > > __ > [EMAIL PROTECTED] mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/r-help > __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postgres
Dear David and Joshua, One can also access PostgreSQL via the RODBC package. There's more information in section 4 of the R Data Import/Export manual, which is part of the R distribution and is also available on CRAN. John At 04:08 PM 2/11/2003 -0500, David Forrest wrote: On 11 Feb 2003, Joshua Gramlich wrote: > Is anyone using R with postgres? I'd like to do so, but cannot seem to > find any reasonable explanation of how to do so. > > > Joshua Gramlich > Chicago, IL library(RPgSQL) # It isn't in an obvious place: # http://lib.stat.cmu.edu/R/CRAN/src/contrib/Devel db.connect() db.ls() Dave, -- Dave Forrest(434)924-3954w(111B) (804)642-0662h (804)695-2026p [EMAIL PROTECTED] http://mug.sys.virginia.edu/~drf5n/ - John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 email: [EMAIL PROTECTED] phone: 905-525-9140x23604 web: www.socsci.mcmaster.ca/jfox - __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postgres
On 11 Feb 2003, Joshua Gramlich wrote: > Is anyone using R with postgres? I'd like to do so, but cannot seem to > find any reasonable explanation of how to do so. > > > Joshua Gramlich > Chicago, IL library(RPgSQL) # It isn't in an obvious place: # http://lib.stat.cmu.edu/R/CRAN/src/contrib/Devel db.connect() db.ls() Dave, -- Dave Forrest(434)924-3954w(111B) (804)642-0662h (804)695-2026p [EMAIL PROTECTED] http://mug.sys.virginia.edu/~drf5n/ __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postgres/R access problems
On Mon, 2003-02-10 at 11:06, [EMAIL PROTECTED] wrote: > I was asking about which R *package* and version: R itself does not > interface to any DBMS, but there are several ways to interface to PgSQL > and they are *packages* like RPgSQL, which has different versions in > different repositories (although AFAIK none are current on CRAN). > (There is also a dbi.something package.) Ah. Now that my brain is in gear. the db.connect in question looks to be from RPgSQL. I suspect it came from sourceforge. Interesting that the maintainer has declared it obsolete - I didn't realise that. More complications Package: RPgSQL Version: 1.0-0 Date: Wed Jun 20 15:18:04 EDT 2001 Title: PostgreSQL access Author: Timothy H. Keitt <[EMAIL PROTECTED]> Maintainer: Timothy H. Keitt <[EMAIL PROTECTED]> Description: Provides methods for accessing data stored in PostgreSQL tables. Depends: R (>= 1.2) License: GPL (version 2 or higher; see LICENSE) URL: http://rpgsql.sourceforge.net/ Built: R 1.5.1; i686-pc-linux-gnu; Fri Jul 5 16:50:14 NZST 2002 These are the loaded libraries from the script I was using to test. library(DBI) library(Rdbi) library(RPgSQL) I have since tried it without DBI and Rdbi and got exactly the same error Error in db.connect(host = "praetorius", This is the whole script (passwords elided) # mine.R thingy <- function(){ #CLEANING UP AND LOADING THE NECESSARY R FUNCTIONS rm(list=ls()) #library(DBI) #library(Rdbi) library(RPgSQL) #SELECT THE HYBS TO BE NORMALISED query <- paste("select usename from pg_user"); print(query); db.connect(host="praetorius",dbname="testdb", pass="XXX",user="brendan"); db.execute(query, clear=F); things<- db.fetch.result(); print(things); } # end script The 'select' works just fine if I use it in psql > > That's the vital piece of information: db.connect is not a part of R per > se, and that seems to be where the problem is. Oh yeah. That part I got to, and thats where my only-recent exposure to R started me lost. I know unix backwards, but I'm an OS person, not an app person. I know that when I use tcpdump to trace the transactions the machines are talking together, and I can't see anything particularly different between the transactions when it works and when it doesn't, except that the one that works returns data. R is happy enough when I get the data. I've just got this odd ball problem where it seems to work fine on some boxes and not on others, despite the fact that they should be damn near identical. The box that works is the 'definitive' workstation in the lab and we rsync changes to it out to the others, though that doesn't stop them getting slowly different from each other as various people need specific enhancements/software. \ > > __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postgres/R access problems
I was asking about which R *package* and version: R itself does not interface to any DBMS, but there are several ways to interface to PgSQL and they are *packages* like RPgSQL, which has different versions in different repositories (although AFAIK none are current on CRAN). (There is also a dbi.something package.) That's the vital piece of information: db.connect is not a part of R per se, and that seems to be where the problem is. On 10 Feb 2003, Brendan Murray wrote: > On Mon, 2003-02-10 at 10:01, Prof Brian D Ripley wrote: > > On 10 Feb 2003, Brendan Murray wrote: > > > > > I have a problem that has exhausted my ingenuity and would like pointers > > > to a solution, or at least where to debug. > > > > > > - I am using R and postgresql. > > > > And which R package are you using, which version, from which repository? > > $ R --version > R 1.5.1 (2002-06-17). > $ /usr/local/pgsql/bin/psql --version > psql (PostgreSQL) 7.2.1 > > repository? I didn't install this originally so I don't know where it > came from. The chap that did has left > > Perhaps the R version is a little past its use-by, but if nobody has > ever seen the error before then upgrading isn't necessarily going to fix > it. It will be my next step if nobody can give me some idea of what > isn't working. > > > > > -- Brian D. Ripley, [EMAIL PROTECTED] 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, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postgres/R access problems
On Mon, 2003-02-10 at 10:01, Prof Brian D Ripley wrote: > On 10 Feb 2003, Brendan Murray wrote: > > > I have a problem that has exhausted my ingenuity and would like pointers > > to a solution, or at least where to debug. > > > > - I am using R and postgresql. > > And which R package are you using, which version, from which repository? $ R --version R 1.5.1 (2002-06-17). $ /usr/local/pgsql/bin/psql --version psql (PostgreSQL) 7.2.1 repository? I didn't install this originally so I don't know where it came from. The chap that did has left Perhaps the R version is a little past its use-by, but if nobody has ever seen the error before then upgrading isn't necessarily going to fix it. It will be my next step if nobody can give me some idea of what isn't working. __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] postgres/R access problems
On 10 Feb 2003, Brendan Murray wrote: > I have a problem that has exhausted my ingenuity and would like pointers > to a solution, or at least where to debug. > > - I am using R and postgresql. And which R package are you using, which version, from which repository? -- Brian D. Ripley, [EMAIL PROTECTED] 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, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help