I am writing a learnr tutorial and find that some exercise chunks do not work and give me unclear errors. The code I am using works fine interactively, so something must be going wrong inside the exercise chunk itself. It may be that the exercise setup does not work well, that the data I use isn't read in correctly, or perhaps the chunk is using a function that I specify elsewhere inside the tutorial but isn't accessed inside the exercise chunk.
This is not about a specific error, but my question is about how we can debug a specific exercise chunk in a learnr tutorial. Ideally, I am looking for something like
browser() which is very useful in interactive settings. In other words, my ideal would be that I click "Run Document" and that some browser-like tool then opens when that specific exercise chunk is reached, so I can see what exactly is going on inside.
I have tried adding
browser() to the chunk, but that doesn't open the browser for me.
Is there something similar that I can use? Is there something that I can put inside the exercise chunk to create some
browser()-like power to trace what is going on inside the exercise chunk itself?