Skip to content

Instantly share code, notes, and snippets.

@yrochat
Last active February 9, 2016 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yrochat/a7cde807fa0ae457cf87 to your computer and use it in GitHub Desktop.
Save yrochat/a7cde807fa0ae457cf87 to your computer and use it in GitHub Desktop.
library(rvest)
library(xml2)
library(stringr)
library(lubridate)
library(ggplot2)
unicode.html <- read_html("https://en.wikipedia.org/wiki/Unicode")
unicode.df <- html_table(xml_find_one(unicode.html, "//*[@id='mw-content-text']/table[4]"), fill = T)[-1,]
colnames(unicode.df)[c(6,7)] <- c("Total", "Notable additions")
unicode.df$Total <- type.convert(str_replace(unicode.df$Total, ",", ""))
unicode.df$Date <- mdy(unicode.df$Date)
day(unicode.df$Date) <- 1
png("unicode.png", width = 600, height = 300)
q <- ggplot(unicode.df, aes(x = Date, y = Total)) + geom_line(stat = "identity", size = 1) + geom_point(size = 2)
q <- q + ylab("Number of unicode characters")
q
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment