Is there a way to read parameters from a file in an R script?
I want to create a config file that has
db_host=xxxx
db_name=xxxx
db_user=xxxx
db_pass=
You can source() an R script in at the top of your main script that reads in your config file parameters. Depending on who you are sharing your scripts with, there may be issues with database security and having the login information in an unencrypted format. There is a recent question here on SO about that, I'll see if I can find it in a minute.
Anyways, store all of your db parameters in a file named config.R and then on your main script, run:
source("config.R") #Will create four objects named "db_host, db_name, db_user, db_pass"
dbConnect(PgSQL(), host=db_host, dbname=db_name, user=db_user, password=db_pass)