Reputation: 161
I try to find a way to debug through R studio, however all the solutions I can find do not really work.
1.) CTRL+enter: works but does not go through every iteration of the loop but only once.
2.) Adding "browser()" stops at that point but I am not able to go from there line by line (neither "n" nor "F10" works?
Any idea what the issue could be?
Upvotes: 11
Views: 15628
Reputation: 23
Put the code/script inside a function:
function_to_debug <- function(data){
a = 2+3
return(a)
}
Then run this in R console:
debug(function_to_debug)
The debugger starts and you can step through each line of the function.
Upvotes: 2