R studio: cannot debug/write in file with browser() during a function call

Solution 1:

It isn't clear what you mean by 'debug'.

You cannot edit function code while it is being executed. You can print the values of arguments and variables, and perform computations on them while stopped at a breakpoint (=="browser()") - from the R console.

You tagged the question RStudio - if indeed you're using it and all you need is to observe the values of variables calculated so far - you don't even need to type their name at the console, just switch to the 'Environment' pane (by default at the top right).