library(knitr)
library(rmdformats)
library(DT)

## Global options
options(max.print = "75")
opts_chunk$set(echo = FALSE,
                 cache = FALSE,
               prompt = FALSE,
               tidy = FALSE,
               comment = NA,
               message = FALSE,
               warning = FALSE)
opts_knit$set(width = 75)

Code and tables

Syntax highlighting

Here is a sample code chunk, just to show that syntax highlighting works as expected.

library(ggplot2)
library(dplyr)

not_null <- function (v) {
  if (!is.null(v)) return(paste(v, "not null"))
}

data(iris)
tab <- iris %>%
  group_by(Species) %>%
  summarise(Sepal.Length = mean(Sepal.Length),
            Sepal.Width  = mean(Sepal.Width),
            Petal.Length = mean(Petal.Length),
            Petal.Width  = mean(Petal.Length))

Verbatim

Here is the structure of the iris dataset.

str(iris)

And blockquote :

Oh ! What a nice blockquote you have here. Much more wonderful than a classical Lorem Ipsum, really.

And we could also include links or simply URLs like this : https://github.com/juba/rmdformats

Table

Here is a sample table output.

kable(tab)

Here is a sample DT:datatable output.

DT::datatable(tab)

Here we display a crosstab displayed in several different ways with a "pills" interface. To do this, just pass your table() result to the pilltabs() function.

iris$seplc <- cut(iris$Sepal.Length,3)
tab <- table(iris$Species, iris$seplc)
pilltabs(tab)

Mathjax

An incredibly complex equation :

$$ y = \sqrt{\frac{1}{x}} $$

Figures

Here is an histogram.

ggplot(data=iris) +
    geom_histogram(aes(x=Petal.Width)) +
    facet_grid(Species~.)

And a wonderful scatterplot, with a caption.

ggplot(data=iris) + geom_point(aes(x=Petal.Width, y=Petal.Length, color=Species))


joebrew/joebrew documentation built on May 19, 2019, 2:59 p.m.