Chapter 1 Prerequisites

This is a sample book written in Markdown. You can use anything that Pandoc’s Markdown supports, e.g., a math equation \(a^2 + b^2 = c^2\).

The required packages can be installed from CRAN or Github:

install.packages("remotes")

Remember each Rmd file contains one and only one chapter, and a chapter is defined by the first-level heading #.

To compile this example to PDF, you need XeLaTeX. You are recommended to install TinyTeX (which includes XeLaTeX): https://yihui.name/tinytex/.

Reproducible maps can be included, e.g. as follows (source: this repo and this issue):

library(tmap)
tmap_mode("view")
pt = "https://katyrobin.github.io/tithe-map-tiles/hereford-many/{z}/{x}/{y}.png"
h = osmdata::getbb("hereford, uk", format_out = "sf_polygon")
m = tm_basemap(leaflet::providers$OpenStreetMap) +
  tm_tiles(pt, tms = TRUE) +
  tm_shape(h) +
  tm_borders() +
  tm_view(set.view = c(
    sf::st_coordinates(sf::st_centroid(h))[1] + 0.004,
    sf::st_coordinates(sf::st_centroid(h))[2],
    16
  ))