---
title: "debugTools"
author: "Roger Day"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{The debugTools component}
%\VignetteEngine{knitr::rmarkdown}
\usepackage[utf8]{inputenc}
---
The shiny apps included in this package include at the top a toggle to show (or hide) a debugTools panel. This panel allows you to investigate what's going on in your package.
Closed, it looks like this:
Open, it looks like this:
On the left, you can toggle on or off the shiny trace option, so see communications between shiny front ends and back ends.
In the middle, you can evaluate a Javascript expression; browsers have good javascript viewers already, but this feature is sometimes convenient. In particular, you can prepend a string that brings you to the javascript sides of the input and output components.
On the right, you can evaluate an R expression. The use of capture.output allows more complex objects unfriendly to cat(), in particular lists, to be viewed, though not always prettily.
You can change or assign values in the GlobalEnv which is in play in the shiny app session. Note that this is not the same GlobalEnv as the one in your interactive RStudio session; changes do not propagate back. It's very hand to debug functions with debug(), and cancel with undebug(), or change options() values.
Due to shiny reactivity, the result updates automatically in response to reactive elements.
The debugTools component is easy to use in other shiny projects. See [Discussion on google forum for shiny](https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/shiny-discuss/yPb30q2DcpI/4VPl2JeU9d8J).