Skip to content

Instantly share code, notes, and snippets.

@srvanderplas
Created August 28, 2018 13:48
Show Gist options
  • Save srvanderplas/bc685dec76289634068566ac831f5e22 to your computer and use it in GitHub Desktop.
Save srvanderplas/bc685dec76289634068566ac831f5e22 to your computer and use it in GitHub Desktop.
Emoji test in Rmarkdown
---
title: "Emoji"
author: "Susan VanderPlas"
date: "8/28/2018"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
- Hadley's `emo` package provides emoji support. Install it with `devtools::install_github("hadley/emo")`.
- In order for emoji to work in Rmarkdown, you must change the file encoding of the Rmd document. Go to File -> Reopen with encoding, then select UTF-8.
- Once you have ensured the file is open in UTF-8 encoding, you should be able to compile with emoji support. 💩
You should even be able to paste emoji from a browser directly into the document. 😺
- It is probably a good idea to change the default encoding for all files to UTF-8 so that you don't have to deal with this issue again.
```{r emoji-test}
emo::ji("poop")
emo::ji("smile")
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment