New sports from random emoji

[This article was first published on Rstats on Julia Silge, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I love emoji ❤️ and I love xkcd, so this recent comic from Randall Munroe was quite a delight for me.

I sat there, enjoying the thought of these new sports like horse hole and multiplayer avocado and I thought, “I can make more of these in just the barest handful of lines of code”. This is largely thanks to the emo package by Hadley Wickham, which if you haven’t installed and started using yet, WHY NOT??? ?

emoji_sports <- function(n) {
    data <- dplyr::sample_n(emo::jis, n)
    emo::ji_glue(paste(dplyr::pull(data, emoji),
                       collapse = ""))
}

This function uses the jis dataset from the emo package, sample a few of them, and then prints them out in a R Markdown document, which is what I use to blog. Let’s make some!

?????‍♂️

Excellent. This new sport is a head injury formalwear competition; it’s judged very strictly.

?????‍♀️

Here we see the new sport of being thankful for Senegalese culture.

⭐️??

This new sport is a scary one, where stars are awarded to the baby chicks with the best knife-throwing skills.

Some of the sports in the xkcd comic have only two characters, and we can make those as well.

????‍♂️

Ah yes, we’ll soon all be enjoying the sport of running long distances for no understandable reason. I think some of you probably already enjoy this sport.

Or we can generate lots with purrr.

library(purrr)

map(sample(c(2,3), 10, replace = TRUE),
    emoji_sports)
## [[1]]
## ?️??‍♀️ 
## 
## [[2]]
## ???‍♀️?? 
## 
## [[3]]
## ⚾?? 
## 
## [[4]]
## ???️??‍♂️ 
## 
## [[5]]
## ??☃✡ 
## 
## [[6]]
## ?️?️?? 
## 
## [[7]]
## ??? 
## 
## [[8]]
## ??‍♂️??? 
## 
## [[9]]
## ☂↘️✋ 
## 
## [[10]]
## ?️??‍♂️

Some of those emojis aren’t printing quite as well, but there are definitely some winners (timed spiderweb fingerknitting and the like).

I could keep going all day, but I’ll wrap it up here. ? Let me know if you have any questions!

To leave a comment for the author, please follow the link and comment on their blog: Rstats on Julia Silge.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)