R Studio not breaking in code on error?

Hi.
If you want to be dropped into the browser() style debugger. then

  1. set the debug menu option for Rstudio to be on error - break in code.
  2. wrap your code in a function, and run that.
testme <- function()
  {
  source("tools.r")

a = c(1,2,3)
b = c(10,20,30)
d = data.frame(a,b)

savedata(d, './d.csv') # call A
savedata(1, './d.csv') # call B
savedata(d, './d.csv') # call C
}

testme()

this takes me to a browser() like environment at the critical juncture...