On Thu, Aug 27, 2015 at 3:46 PM, John McKown <john.archie.mck...@gmail.com> wrote: > On Thu, Aug 27, 2015 at 2:29 PM, Abraham Mathew <mathewanalyt...@gmail.com> > wrote: > >> I have a user-defined function that I'm using alongside a postgresql >> connection to >> summarize some data. I've connected to the local machine with no problem. >> However, >> the connection keeps throwing the following error when I attempt to use it. >> Can anyone point >> to what I could be doing wrong. >> >> > ds_summary(con, "test", vars=c("Age"), y=c("Class")) >> Error in postgresqlNewConnection(drv, ...) : >> RS-DBI driver: (could not connect postgres@localhost on dbname "test" >> ) >> >> >> con is the connection >> > > It would be helpful to see the assignment to "con" as well as any other > assignments related to this. If you are using the DBI package, then what I > am talking about would be something like: > > drv<-dbDriver("PgSQL") > con<-dbConnect(drb,user=...,password=...,dbname="test');
FWIW the best way to create a connection is: library(DBI) con <- dbConnect(RPostgreSQL::PostgreSQL(), ...) The older string based approach is not advised. Hadley -- http://had.co.nz/ ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.