File: interactiveDisplayBase.R

package info (click to toggle)
r-bioc-interactivedisplaybase 1.36.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 124 kB
  • sloc: javascript: 58; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 878 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## ----setup, echo=FALSE--------------------------------------------------------
suppressWarnings(suppressPackageStartupMessages(library(knitr)))
options(width=80)

## ----wrap-hook, echo=FALSE----------------------------------------------------
hook_output = knit_hooks$get('output')
knit_hooks$set(output = function(x, options) {
  # this hook is used only when the linewidth option is not NULL
  if (!is.null(n <- options$linewidth)) {
    x = knitr:::split_lines(x)
    # any lines wider than n should be wrapped
    if (any(nchar(x) > n)) x = strwrap(x, width = n)
    x = paste(x, collapse = '\n')
  }
  hook_output(x, options)
})

## ----interactiveDisplayBase-load,include=TRUE,results="hide",message=FALSE,warning=FALSE----
library(interactiveDisplayBase)

## ----dataframe_demo, eval=FALSE-----------------------------------------------
#  mtcars2 <- display(mtcars)