Code
deferred_run()
Message
No deferred expressions to run
Code
local({
local_tempfile()
local_tempfile()
deferred_run()
})
Message
Ran 2/2 deferred expressions
Code
expect_error(local({
local_tempfile()
defer(stop("foo"))
local_tempfile()
deferred_run()
}))
Message
Ran 1/3 deferred expressions
deferred_run()
in knitrCode
writeLines(readLines(out))
Output
``` r
withr::deferred_run()
```
```
## No deferred expressions to run
```
``` r
defer(writeLines('1'))
writeLines('2')
```
```
## 2
```
``` r
defer(writeLines('3'))
```
``` r
writeLines('4')
```
```
## 4
```
``` r
withr::deferred_run()
```
```
## 3
## 1
```
```
## Ran 2/2 deferred expressions
```
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.