R Markdown test

Some example Python code:

import re
for test_string in ['555-1212', 'ILL-EGAL']:
  if re.match(r'^\d{3}-\d{4}$', test_string):
    print test_string, 'is a valid US local phone number'
  else:
    print test_string, 'rejected'

… and R code:

cube <- function(x) {
  if (!is.numeric(x))
    stop("'x' must be numeric")
  return(x^3)
}
# Use this function
cube(1:10)

R Chunks:

R Markdown

Test of an R Markdown post, see http://rmarkdown.rstudio.com. You can embed an R code chunk like this:

cars_lm <- lm(dist ~ speed, data = cars)
cars_lm
## 
## Call:
## lm(formula = dist ~ speed, data = cars)
## 
## Coefficients:
## (Intercept)        speed  
##     -17.579        3.932

Including Plots

You can also embed plots. See Figure 1 for example:

par(mar = c(0, 1, 0, 1))
pie(
  c(280, 60, 20),
  c('Sky', 'Sunny side of pyramid', 'Shady side of pyramid'),
  col = c('#0292D8', '#F7EA39', '#C4B632'),
  init.angle = -50, border = NA
)
A fancy pie chart.

Figure 1: A fancy pie chart.

You can use an alert note to stand out a section.

Hugo shortcodes

In R Markdown, you should not use the {{< tweet 936232450006704128 >}} syntax. Instead, you should use:

Other examples

Youtube

Vimeo

Github Gist

Speakerdeck

Figure

A nice fluorescent coral

Related

comments powered by Disqus