Better R script & psql options

* Better R script that can accept parameter values from Python

* psql options to make "-x" view possible

* Various small improvements