Skip to content

Instantly share code, notes, and snippets.

@RobertMyles
Created February 4, 2017 12:56
Show Gist options
  • Save RobertMyles/5c4e5a4131ce13d3a478abbcacc642df to your computer and use it in GitHub Desktop.
Save RobertMyles/5c4e5a4131ce13d3a478abbcacc642df to your computer and use it in GitHub Desktop.
little script to see what emojis are available with the emojifont package in R.
library(rvest)
library(stringr)
library(emojifont)
library(tidyverse)
url <- "http://www.webpagefx.com/tools/emoji-cheat-sheet/"
page <- read_html(url)
nodes <- html_nodes(page, css = "#content")
text <- html_text(nodes)
txt <- data_frame(label = unlist(str_extract_all(text, ":[a-z_]*:"))) %>%
mutate(label = gsub(":", "", label))
txt <- txt %>%
mutate(emoji_code = NA)
for(i in 1:nrow(txt)){
try(txt$emoji_code[i] <- emoji(txt$label[i]))
}
txt <- txt %>%
filter(!is.na(emoji_code))
knitr::kable(txt, format = "markdown")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment