Syntax highlighting in RMarkdown

Sample R code black:

library(ggplot2)

centre <- function(x, type, ...) {
  switch(type,
         mean = mean(x),
         median = median(x),
         trimmed = mean(x, trim = .1))
}

var <- NULL
comments powered by Disqus