How to debug R code with Note

In this document, it explains how you can debug your R code with a Note.

R Code block in a Note

On Note Editor, you can click the “R” button like to embed an R code block in a Note. Good thing about this R code block is that you can control whether error, warning, etc are shown in the result by adjusting R code block option.

When you click the “R” button, it inserts an R Code Block like above. So copy and pate an R script you want to try and make sure to set “warning=TRUE, message=TRUE, echo=TRUE, error=TRUE, cache=FALSE” so that you can see detail messages, warnings, errors from your R code.

And if you run this R code, you can see error message like below if something is wrong with the code. In this example, since dddd is not available on R session, it says ‘dddd’ not found.

SQL Query Example

If you want to debug a SQL query related R code, you can right a R Script to access to a database like below.

Then you can see some error message like this if the R script contains incorrect credentials for example.