Rather than hardcoding variables into script is better to use passing them as possitional arguments in Rscript or setting them in R environment before the script (which needs them) is sourced.
Interpreting R scripts with positional erguments
Regarding passing arguments (as your variables) to script, you can find some already answered questions on SO. The above link is just a starter.
R-intro B.4 Scripting with R is the official source.
Rpy2 Changing objects in R environment
You could set or change (by Rpy2 means) variables in R environment before sourcing the rscript, which will use already set variables, so the script must be prepared not to set them but just use them.