| 1 |
--- |
| 2 |
title: "Printing a tibble: Tracking control flow" |
| 3 |
output: html_vignette |
| 4 |
vignette: > |
| 5 |
%\VignetteIndexEntry{Printing a tibble: Tracking control flow} |
| 6 |
%\VignetteEngine{knitr::rmarkdown} |
| 7 |
%\VignetteEncoding{UTF-8} |
| 8 |
--- |
| 9 |
|
| 10 |
```{r, include = FALSE} |
| 11 |
knitr::opts_chunk$set( |
| 12 |
collapse = TRUE, |
| 13 |
comment = "#>" |
| 14 |
) |
| 15 |
``` |
| 16 |
|
| 17 |
What happens when a tibble is printed? |
| 18 |
This vignette shows the actual control flow, powered by the [debugme package](https://github.com/r-lib/debugme#readme). |
| 19 |
See `vignette("printing")` for a detailed description of the control and data flows. |
| 20 |
|
| 21 |
To activate debugging, we need to set an environment variable before loading the pillar package. |
| 22 |
As a result, debug strings in pillar's code are replaced with calls to a logging function. |
| 23 |
|
| 24 |
By default, debugme also shows timestamps. |
| 25 |
This is disabled to keep the output stable. |
| 26 |
|
| 27 |
```{r eval = FALSE} |
| 28 |
Sys.setenv(DEBUGME = "!!!!pillar") |
| 29 |
Sys.setenv(DEBUGME_SHOW_TIMESTAMP = "no") |
| 30 |
|
| 31 |
library(pillar) |
| 32 |
|
| 33 |
tbl <- tibble::tibble(a = 1:3, b = tibble::tibble(c = 4:6, d = 7:9), e = 10:12) |
| 34 |
print(tbl, width = 23) |
| 35 |
``` |
| 36 |
|
| 37 |
```{r echo = FALSE} |
| 38 |
writeLines(readLines("debugme.txt")) |
| 39 |
``` |