This is what I do - this is not formal debugging, but it works for me.
top of the prog.R script example:
# uncomment this section to run using Rscript from command line: userprefs <- commandArgs(trailingOnly = TRUE) x <- userprefs[1] y <- userprefs[2] z <- userprefs[3]
When troubleshooting in your script, comment out one or the other section depending on whether you are a source in RStudio or using RScript from the command line.
source share