Websites using RMarkdown
Making a website using RStudio
Documentation on authoring webpages using RMarkdown and Github (to host the site)
🔗 Links
- Chapter 10 Websites from R Markdown: The Definitive Guide
- Happy Git and GitHub for the useR
- Great tutorial to follow on getting started with GitHub and RStudio
- Offical R Markdown Websites lesson from RStudio
- An R Markdown Website Template available here
🔗 Other helpful resources
YAML
Example _site.yml
doc
name: "Bioinformatics & Phylogenetics"
output_dir: "docs"
navbar:
title: "Code"
left:
- text: "Home"
href: index.html
- text: "RStudio"
icon: fa-file-alt
menu:
- text: Introduction
href: rstudio-intro.html
- text: "---------"
- text: "Plots & data"
- text: Aesthetics
href: rstudio-aesthetics.html
- text: Plots
href: rstudio-plots.html
- text: Statistics
href: rstudio-statistics.html
- text: "---------"
- text: "RMarkdown"
- text: Introduction
href: rmd-intro.html
- text: Bookdown
href: rmd-bookdown.html
- text: Websites
href: rmd-webpages.html
- text: "Sequence files"
icon: fa-dna
menu:
- text: Command line
href: sequence-files.html
- text: Visualising and editing
href: visualise.html
- text: "Muscle"
href: muscle.html
- text: "Phylogenetics"
icon: fa-code-branch
menu:
- text: "Introduction"
href: phylo-intro.html
- text: "Evolutionary models"
href: evolutionary-models.html
- text: "IQ-TREE"
href: iqtree.html
- text: "MrBayes"
href: mrbayes.html
output:
html_document:
theme: yeti
highlight: monochrome
include:
after_body: footer.html
Icons for webpages
Themes
If using the Simple R Markdown website
option to create a website then the default available themes options include: “cerulean”, “cosmo”, “cyborg”, “darkly”, “flatly”, “journal”, “lumen”, “paper”, “readable”, “sandstone”, “simplex”, “slate”, “spacelab”, “superhero”, “united”, “yeti”…check them out here. Highlight options include: “default”, “tango”, “pygments”, “kate”, “monochrome”, “espresso”, “zenburn”, “haddock”, “breezedark”, “textmate”.
They can be changed by including the following in the ‘YAML’
:
output:
html_document: united
theme: monochrome highlight
Bootswatch
::install_github("rstudio/bootstraplib")
remoteslibrary(bootstraplib)
To start using bootstraplib in your rmarkdown::html_documents, install the following:
remotes::install_github("rstudio/rmarkdown#1706")
Use bootstrap_version
and theme
to choose the Bootstrap version and a Bootswatch theme. These arguments are currently supported only in html_document
and html_document_base
.
---
output:
html_document:
bootstrap_version: 4+3
theme: minty
---
You can also add theme customizations inside any R code chunk (these customizations end up influencing the Bootstrap CSS included in the output document).
library(bootstraplib)
bs_theme_accent_colors(primary = 'green')
Some extra info here
Extra
Get extra bits of html from the bootswatch theme webpages. E.g. minty
Bootstrap customisation
Further HTML customisation with the bootstrap theme available here
Blogdown
Another option of creating a website in RStudio is using Blogdown.
Useful resources and examples