Last active
December 6, 2015 17:15
-
-
Save expersso/e69ee0ebb4f214dbe544 to your computer and use it in GitHub Desktop.
Length of names of months and weekdays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(lubridate) | |
library(ggplot2) | |
period_name <- c(month.name, as.character(wday(1:7, label = TRUE, abbr = FALSE))) | |
name_length <- sapply(strsplit(period_name, ""), length) | |
df <- data.frame(period_name, name_length, period_order = c(1:12, 1:7), | |
type = rep(c("Months", "Weekdays"), c(12, 7))) | |
ggplot(df, aes(x = period_order, y = name_length, label = period_name)) + | |
geom_smooth(se = FALSE) + | |
geom_text(size = 3, hjust = "inward", position = "jitter") + | |
facet_wrap(~type, scales = "free") + | |
theme_bw() + | |
scale_x_continuous(breaks = 1:12) + | |
labs(x = "\nPeriod order", y = "# of characters in name\n", | |
title = "Length of names of months and weekdays\n") |
Author
expersso
commented
Dec 6, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment