In this post I'd like to introduce the R Markdown template for business reports by INWTlab. It's been my aim to have a nice and clean template that is easy to customize in colors, cover and logo. I know there are quite a few templates available, but I was missing one to be used in a corporate environment. That is, I want to have a logo included and a cover page that also can be styled in a corporate design. In many companies nowadays MS Word is still THE reporting tool, so the overall look and feel is loosly oriented at MS Word defaults. In addition, this template can be extended by hacking the tex file defs.tex. In my eyes a tex file is way easier to hack - especially for not so experienced latex users - than style files (.sty).

Installation

You can install the package from the INWTlab Github Repository ireports. If you haven't installed devtools yet, please do that first.

One of the neat tools available via a variety of packages in R is the creation of beautiful tables using data frames stored in R. In what follows, I’ll discuss these different options using data on. Turn your analyses into high quality documents, reports, presentations and dashboards with R Markdown. Use a productive notebook interface to weave together narrative text and code to produce elegantly formatted output. Use multiple languages including R, Python, and SQL. R Markdown supports a reproducible workflow for dozens of static and dynamic output formats including HTML, PDF, MS.

Once the package is installed, you can already use the template in its default version by selecting R Markdown.. > From Template > INWTlab Business Report and then clicking OK. As result a new Rmd script pops up and you can knit it right away. This is what the default report looks like:

Usage

Text & Graphics

You can write text and add graphics just like you would in any other R Markdown document.

Tables

In order to generate tables in MS Word style you can use the example code snippet below. It renders a table from the iris data set.

This code snippet consists of three parts:

  1. The table creation. With xtable() I create an object tab of class xtable. Make sure to edit the align option as the number of columns changes.
  2. The coloring of the header row. I color the header via a latex code snippet which is placed in the header of the latex table code. The add.to.row option in print() enables me to put a code snippet into the latex code wherever I like by specifying a command and a position in a separate list, here called addtorow.
  3. The table printing itself.

So, when you create a new table, all you have to do is to create the xtable object tab in the first row, making sure that the align has the right number of columns specified.

Customization

Logo and Cover

When you create a new R Markdown file from the template, RStudio creates a new folder in your working directory (check with getwd()). You can overwrite logo.png and cover.png in this folder with your own files. Keep in mind to either name your files exactly like mine or to correct the file names in the yaml header. The recommended dimension for the logo is 350 x 130 pixels. The cover should have 1654 x 2339 pixels. In the case you want to use other dimensions, you need to hack the tex file defs.tex in order to make it look nice.

Colors

There are currently two colors in use, namely iblue and igray. If you'd like to adopt your corporate colors, change the hexadecimal color values for iblue and igray in the yaml header.

Collaboration

You're welcome to help improve this template, just open an issue on GitHub or send a pull request.

The Gitiles source browser automatically renders *.md Markdown files into HTML for simplified documentation.

Access controls

Inmarsat global driver download for windows. Access controls for documentation is identical to source code.

Documentation stored with source files shares the same permissions. Documentation stored in a separate Git repository can use different access controls. If Gerrit Code Review is being used, branch level read permissions can be used to grant or restrict access to any documentation branches.

READMEs

Drivers msi. Files named README.md are automatically displayed below the file's directory listing. For the top level directory this mirrors the standard GitHub presentation.

README.md files are meant to provide orientation for developers browsing the repository, especially first-time users.

We recommend that Git repositories have an up-to-date top-level README.md file.

Markdown syntax

Gitiles supports the core Markdown syntax described in Markdown Basics. Additional extensions are supported to more closely match GitHub Flavored Markdown and simplify documentation writing.

Paragraphs

Paragraphs are one or more lines of consecutive text, followed by one or more blank lines. Line breaks within a paragraph are ignored by the parser, allowing authors to line-wrap text at any comfortable column width.

Headings

Headings can be indicated by starting the line with one or more # marks. The number of # used determines the depth of the heading in the document outline. Headings 1 through 6 (######) are supported.

Headings can also use the less popular two line and ------ forms to create H1 and H2 level headers:

This form is discouraged as maintaining the length of the or --- lines to match the preceding line can be tedious work that is unnecessary with the # headers.

Lists

A bullet list:

will render into HTML as:

  • Fruit
    • Orange
    • Pear
  • Cake

The second level items (above Orange, Pear) must be indented with more spaces than the item they are nested under. Above 2 spaces were used. Additionally, the entire list must be preceded and followed by a blank line.

A numbered list:

will render into HTML as:

  1. Fruit
    1. Orange
    2. Pear
  2. Cake

List items will be renumbered sequentially by the browser, which is why 5 above displays as 2. Even with this feature it is a good idea to maintain list item numbers in the source Markdown to simplify reading the source file.

Like bullet lists, numbered lists can be nested by using more leading space than the prior list item.

Paragraphs can be properly nested within lists by indenting with at least 2 leading spaces:

Tables

Requires markdown.tables to be true (default).

Simple tables are supported with column alignment. The first line is the header row and subsequent lines are data rows:

will render as:

FoodCaloriesTasty?
Apple95Yes
Pear102Yes
Hay977

List Of Figures R Markdown

Placing : in the separator line indicates how the column should be aligned. A colon on the left side is a left-aligned column; a colon on the right-most side is right-aligned; a colon on both sides is center-aligned. If no alignment is specified, the column is aligned with the default for HTML <td> tags (left-aligned by default unless overridden by css).

Empty table cells are indicated by whitespace between the column dividers (| |) while multiple column cells omit the whitespace.

Emphasis

Emphasize paragraph text with italic and bold styles. Either _ or * can be used for italic (1 character) and bold text (2 characters). This allows styles to be mixed within a statement:

It is strongly encouraged to review documentation for typos.

Emphasis within_words_is_ignored which helps write technical documentation. Literal *bold* can be forced by prefixing the opening * with such as *bold*.

Strikethrough

Requires markdown.strikethrough to be true (default).

Text can be struck out within a paragraph:

Note two tildes are required (~~) on either side of the struck out section of text.

Blockquotes

Blockquoted text can be used to stand off text obtained from another source:

renders as:

Sir Winston Churchill once said:

A lie gets halfway around the world before the truth has a chance to get its pants on.

Code (inline)

Use backticks to markup inline code within a paragraph:

Code (blocks)

Create a fenced code block using three backticks before and after a block of code, preceeded and followed by blank lines:

Text within a fenced code block is taken verbatim and is not processed for Markdown markup.

Syntax highlighting can optionally be enabled for common languages by adding the language name in lowercase on the opening line. Supported languages include:

Web

  • css
  • dart
  • html
  • javascript, js
  • json

Markup

  • tex, latex
  • wiki
  • xml
  • xquery
  • xsl
  • yaml

Other

  • clj (Clojure)
  • erlang
  • hs (Haskell)
  • lisp
  • matlab
  • ml (OCaml, SML, F#)
  • r
  • rust
  • sql
  • vhdl

Horizontal rules

If markdown.ghthematicbreak is true, a horizontal rule can be inserted using GitHub style -- surrounded by blank lines. Alternatively repeating - or * and space on a line will also create a horizontal rule:

Links

Wrap text in [brackets] and the link destination in parens (http://..) such as:

Links can also use references to obtain URLs from elsewhere in the same document. This style can be useful if the same URL needs to be mentioned multiple times, is too long to cleanly place within text, or the link is within a table cell:

References can be simplified if the text alone is sufficient:

Automatic hyperlinking can be used where the link text should obviously also be the URL:

Well formed URLs beginning with https://, http://, and mailto: are used as written for the link's destination. Malformed URLs may be replaced with about:invalid#zSoyz to prevent browser evaluation of dangerous content.

HTML escaping of URL characters such as & is handled internally by the parser/formatter. Documentation writers should insert the URL literally and allow the parser and formatter to make it HTML safe.

Relative links such as ./src/api.md are resolved relative to the current markdown's file path within the Git repository. Absolute links such as /src/api.md are resolved relative to the top of the enclosing Git repository, but within the same branch or Git commit. Links may point to any file in the repository. A link to a *.md file will present the rendered markdown, while a link to a source file will display the syntax highlighted source.

Named anchors

Explicit anchors can be inserted anywhere in the document using <a name='tag'></a>, or {#tag} if markdown.namedanchor is true.

Implicit anchors are automatically created for each heading. For example ## Section 1 will have the anchor Section-1.

List R Markdown

Anchor generation

  • letters and digits, after removing accents (á → a)
  • spaces are replaced with hyphens (-)
  • other characters are replaced with underscores (_)
  • runs of hyphens and underscores are collapsed

If a document contains the same named subsection under different parents the parent anchor will prefix the subsections to disambiguate. For example the following document will have anchors Running-Format and Coding-Format and Libraries as that subsection is unique:

When placed in a section header the explicit anchor will override the automatic anchor. The following are identical and associate the anchor live-examples with the section header instead of the automaticly generated name Examples.

Images

Similar to links but begin with ! to denote an image reference:

For images the text in brackets will be included as the alt text for screen readers.

Well formed image URLs beginning with https:// and http:// will be used as written for the <img src='..'> attribute. Malformed URLs will be replaced with a broken data: reference to prevent browsers from trying to load a bad destination.

Relative and absolute links to image files within the Git repository (such as ./images/banner.png) are resolved during rendering by inserting the base64 encoding of the image using a data: URI. Only PNG (*.png), JPEG (*.jpg or *.jpeg), GIF (*.gif) and WebP (*.webp) image formats are supported when referenced from the Git repository.

Unsupported extensions or files larger than image size limit (default 256K) will display a broken image.

Inline image caching

Gitiles allows browsers to locally cache rendered markdown pages. Cache invalidation is triggered by the markdown file being modified and having a different SHA-1 in Git. Inlined images may need a documentation file update to be refreshed when viewed through unstable URLs like /docs/+/master/index.md.

HTML

Most HTML tags are not supported. HTML will be dropped on the floor by the parser with no warnings, and no output from that section of the document.

If markdown.safehtml is true there are small exceptions for <br>, <hr>, <a name> and <iframe> elements, see named anchor and HTML IFrame.

Markdown extensions

Gitiles includes additional extensions to the Markdown language that make documentation writing for the web easier without using raw HTML.

Table of contents

Requires markdown.toc to be true.

Place [TOC] surrounded by blank lines to insert a generated table of contents extracted from the H1, H2, and H3 headers used within the document:

H1 headers are omitted from the table of contents if there is only one level one header present. This allows H1 to be used as the document title without creating an unnecessary entry in the table of contents.

Anchors are automatically extracted from the headers, see named anchors.

Notification, aside, promotion blocks

Jungo motherboards driver download. Requires markdown.blocknote to be true.

Similar to fenced code blocks these blocks start and end with ***, are surrounded by blank lines, and include the type of block on the opening line.

Note

Aside

An aside can stand off less interesting text.

Promo

Promotions can raise awareness of an important concept.

Column layout

Requires markdown.multicolumn to be true.

Gitiles markdown includes support for up to 12 columns of text across the width of the page. By default space is divided equally between the columns.

Prettify

the page layout.

A column layout is denoted by a block starting and ending with the sequence |||---|||. Within the layout a new column is started for each header or note/promo/aside block and all text and formatting flow into that column until a new column is started.

Column spans can be specified on the first line as a comma separated list. In the example below the first column is 4 wide or 4/12ths of the page width, the second is 2 wide (or 2/12ths) and the final column is 6 wide (6/12ths or 50%) of the page.

An empty column can be inserted by prefixing its width with :, for example shifting content onto the right by padding 6 columns on the left:

renders as:

Right

HTML IFrame

Requires markdown.safehtml to be true (default).

Although HTML is stripped the parser has special support for a limited subset of <iframe> elements:

The parser allows whitespace including newlines between attributes, but strictly limits the supported attribute set to:

src : An https:// or http:// URL of the page to embed inside of an iframe at this position in the document. Malformed URLs will cause the iframe to be silently dropped. (required)

height : CSS pixel height such as 250px defining the amount of vertical space to give to the embedded content. Only px units are supported; a malformed dimension will drop the iframe. (required)

width : CSS pixel width such as 250px or a precentage such as 80% defining the amount of horizontal space to give to the embedded content. Only px units or % are supported; a malformed dimension will drop the iframe. (required)

R Markdown List Without Bullets

frameborder : By default a border is drawn around the iframe by the browser. The border can be hidden by adding frameborder='0' to the iframe tag. (optional)

Embedded source URLs must also be whitelisted by the Gitiles markdown.allowiframe configuration variable.

Site layout

Gitiles includes additional support to create functional documentation sites served directly from Git repositories.

Navigation bar

A top level navigation bar is automatically included on all pages if there is a navbar.md file present in the top of the repository. This file should be a simple bulleted list of links to include in the navigation bar.

Links are resolved relative to the current page, not navbar.md. Links to other files within the repository should use absolute paths to ensure they are resolved correctly from any Markdown file within the repository.

Site title

A site-wide banner is displayed on all Markdown pages if navbar.md includes an H1 header. The text of the header is displayed on the left side of the banner.

Site logo

An optional logo image is displayed in the banner to the left of the site title if a [logo] reference exists in navbar.md. This image should be no taller than 45 px.

See images above for acceptable URLs and how repository relative paths are handled by inline data URIs.

Home link

Both the site logo (if present) and site title are wrapped in a link if the [home] reference is declared in navbar.md. This is typically also used in the outline for the navigation bar:

Page title

Titles for pages are extracted from the first H1 heading appearing in the document. This is traditionally placed on the first line of the markdown file, e.g.:

The title is included in the HTML <title> element and also in the right side of the banner if navbar.md defines a site title.

Configuration

The gitiles.config file supporting the site contains several configuration options that impact markdown rendering. Refer to the configuration documentation for details.