I find myself doing something quite similar to what you describe and I find myself using functions like this for that purpose:
runSQL <- function(sql_file) {
library(RPostgreSQL)
pg <- dbConnect(PostgreSQL())
sql <- paste(readLines(sql_file), collapse="\n")
rs <- dbGetQuery(pg, sql)
dbDisconnect(pg)
}
This function does not return data, but it would be easy to tweak such that it does (though make sure to disconnect within the function if you are running the function many times).
One nice aspect of this is that escaping of backslashes, etc., happens seamlessly (at least for my use cases).
-Ian