Global Style for Rmd Example

knitr::opts_chunk$set(echo = TRUE)


When presenting tables in an HTML Rmarkdown report, it is more common to have all tables styled in the same manner. This is an example of all tables having the same style, with a few overridden styles.

This package is meant to implement the concept of a grammar of tables. It allows for a simple formula expression and a data frame to create a rich summary table in a variety of formats. It is designed for extensibility at each step of the process, so that one is not limited by the authors choice of table statistics, output format. The grammar however is an integral part of the package, and as such is not modifiable.

Supposed that further in addition to the lancet style one really wanted a shade of cyan to make the document pop. This was added to the header of this document to make all this magic happen:

 <style type="text/css">
 .figbody thead
   background: #aaffff !important;
 .figbody tbody .odd
   background: #aaffff !important;

Here's an example similary to summaryM from Hmisc to get us started:

Table 1

html5(tangram("drug ~ bili[2] + albumin + stage::Categorical + protime + sex + age + spiders", tangram::pbc),
      fragment=TRUE, caption = "Hmisc::PBC", id="tbl2")

Table 2

x <- round(rnorm(375, 79, 10))
y <- round(rnorm(375, 80,  9))
y[rbinom(375, 1, prob=0.05)] <- NA
attr(x, "label") <- "Global score, 3m"
attr(y, "label") <- "Global score, 12m"
html5(tangram(1 ~ x+y,
                    data.frame(x=x, y=y),
      fragment=TRUE, caption="Intercept", id="tbl5")

Try the tangram package in your browser

Any scripts or data that you put into this service are public.

tangram documentation built on June 5, 2018, 1:04 a.m.