Skip to content

Instantly share code, notes, and snippets.

View gorgitko's full-sized avatar

Jiri Novotny gorgitko

View GitHub Profile
@gorgitko
gorgitko / dt_add_header_tooltips.R
Last active March 26, 2020 07:53
Simple function to add header tooltips to DT::datatable. Uses Bootstrap 3 tooltip component: https://getbootstrap.com/docs/3.3/javascript/#tooltips
# table_dt: DT::datatable
# tooltips: List of tooltips. Names = header names, values = tooltips.
# add_to_header_name: Will be appended to header name. Defaultly a question mark in circle.
# See https://getbootstrap.com/docs/3.3/components/ for more glyphicons
# tooltip_params: Parameters for Bootstrap's tooltip component.
# See https://getbootstrap.com/docs/3.4/javascript/#tooltips-options
# Will be converted to JSON with jsonlite::toJSON(tooltip_params, auto_unbox = TRUE)
# container = "body" is important as it always shows a tooltip on top of other elements.
dt_add_header_tooltips <- function(
table_dt,
@gorgitko
gorgitko / example.Rmd
Last active April 16, 2020 10:53
In HTML output of RMarkdown document, it adds tooltips to code chunks which show their language. Uses https://atomiks.github.io/tippyjs/
---
title: "Code chunks language tooltips"
output:
html_document:
theme: "united"
self_contained: true
---
<!--You need to use Bootstrap theme (e.g. "united") to load dependencies. -->