Skip to content

Commit 4b8eb01

Browse files
committed
start work on ioslides deck
1 parent 49f431c commit 4b8eb01

File tree

4 files changed

+91
-19
lines changed

4 files changed

+91
-19
lines changed

images/texturebg.png

1.17 KB
Loading

shiny-debug-doc.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ date: "January 18, 2016"
55
output:
66
html_document:
77
highlight: textmate
8-
theme: flatly
8+
theme: journal
99
---
1010

1111
# Introduction
@@ -18,7 +18,7 @@ We'll cover three main approaches:
1818

1919
1. **Debugging**
2020

21-
Pausing execution of your program, at a place you choose, to inspect its state. Best used when you suspect where a problem lies or need to verify the state around a particular section of code.
21+
Pausing execution of your program, at a place you choose, to inspect its state as each following statement is executed. Best used when you suspect where a problem lies or need to verify the state around a particular section of code.
2222

2323
2. **Tracing**
2424

shiny-debugging.Rmd

Lines changed: 81 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,96 @@
11
---
2-
title: "Untitled"
3-
author: "Jonathan McPherson""
2+
author: "Jonathan McPherson"
43
title: Debugging with Shiny
5-
output: ioslides_presentation
4+
output:
5+
ioslides_presentation:
6+
css: shiny-slides.css
7+
highlight: textmate
8+
self_contained: no
69
---
710

811
# Overview
912

10-
We'll cover four main areas:
11-
- Tracing Execution
12-
- Tracing Errors
13+
## Outline
14+
15+
We'll cover three main areas:
16+
1317
- Debugging
18+
- Tracing
19+
- Errors
20+
21+
# Debugging
22+
23+
"Finding your bug is a process of confirming the many things that you believe are true — until you find one which is not true."
24+
25+
-- Norm Matloff
26+
27+
Author of *The Art of R Programming* and *The Art of Debugging*
28+
29+
## Breakpoints
30+
31+
![breakpoints](images/breakpoint.png)
32+
33+
*Breakpoint (armed)*
34+
35+
## Breakpoints
36+
37+
![breakpoints](images/breakpoint-hit.png)
38+
39+
*Stepping after execution*
40+
41+
## Breakpoints {.build}
42+
43+
### Pros
1444

15-
# Showcase mode
45+
- Doesn't change code
46+
- Can inspect local values/stack
47+
- Can step through following code
1648

17-
# The Reactive Graph
49+
### Cons
1850

19-
# JavaScript error console
51+
- Only works inside `shinyServer`
52+
- Can't tell you why something isn't happening
53+
- Interrupts program flow; not conditional
2054

21-
# Shiny traces
55+
## browser()
2256

23-
# Deployed Apps
57+
![browser](images/browser.png)
2458

25-
options()
59+
## browser() {.build}
2660

27-
```{r}
28-
# Check JavaScript error console (btw it would be great to have a decent experience for doing this in RStudio someday)
29-
# options(shiny.trace = TRUE) to see what messages are going back and forth between the browser and server. This is mostly useful when you're writing your own custom bindings, or if you're not sure why something's not updating.
30-
# options(shiny.error) and options(shiny.observer.error). Honestly I'm not sure if these are working correctly. That was something I was hoping one of us (you, Winston, or I) could look into.
31-
# Collecting tracebacks when errors occur in observers/reactives. Again, not exactly sure what the answer is here, also needs investigation by one of us.
61+
### Pros
62+
63+
- Similar advantages to breakpoints
64+
- Valid anywhere an R expression is valid
65+
- Can be made conditional
66+
67+
### Cons
68+
69+
- Changes your code!
70+
- Interrupts program flow
71+
- Can't tell you why something isn't happening
72+
73+
# Tracing
74+
75+
## Showcase Mode
76+
77+
![showcase mode](images/kmeans-showcase.gif)
78+
79+
```{r eval=FALSE}
80+
runApp(..., display.mode="showcase")
81+
```
82+
83+
## Reactive Log
84+
85+
![reactive log](images/reactlog.png)
86+
87+
```{r eval=FALSE}
88+
options(shiny.reactlog=TRUE)
89+
runApp(...)
90+
showReactLog()
3291
```
92+
93+
# Error Handling
94+
95+
96+

shiny-slides.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
slides > slide.dark {
2+
background-image: url(images/texturebg.png);
3+
}
4+
5+
slide img {
6+
max-width: 768px;
7+
max-height: 350px;
8+
}

0 commit comments

Comments
 (0)