output_lines: Print certain output lines

Description Usage Details Examples

View source: R/hooks.R

Description

Print only lines of the R output that the user specifies. This works similarly to how echo works for printing R code.

Usage

1

Details

To run this hook, call the output_lines() function and then you can either print a number of lines for all chunks

knitr::opts_chunk$set(output_lines = 1:10)

or you can specify it on a chunk by chunk basis

1
2
3
```{r output_lines = 3:15}
print(mtcars)
```

Several options are available

output_lines = n

prints lines 1:n ...

output_lines = 1:n

prints lines 1:n ...

output_lines = 3:15

prints lines ... 3:15 ...

output_lines = -(1:8)

removes lines 1:8 and prints ... 9:n ...

Note, there is no allowance for anything but a consecutive range of lines

Examples

1

nathaneastwood/knitrhooks documentation built on May 4, 2019, 3:18 p.m.