Little Miss Data

View Original

Happy Holidays Data Lovers!

Warmest seasons greetings to all of my fellow data nerds!

Like myself, I know that a lot of you love pretty visualizations.  So, this Christmas I am giving the small gift of a new R package to explore.  I will be providing a more in-depth example in the next few weeks.  In the meantime, below is a teaser. 

Run this code in any R environment, including R Studio and IBM Cloud Data Science Experience.

## A fun plot to say seasons greetings
install.packages("alluvial")
library(alluvial)

data2 <- read.table(header=TRUE, text='
 subject Joyeaux Noel freq
                   1   Happy   Holidays   1
                   2   Seasons   Greetings   1
                   ')

dataframe <- as.data.frame(data2)

alluvial(dataframe[,2:3], freq=dataframe$freq,
         col = ifelse(dataframe$Joyeaux == "Happy", "red", "green"),
         border = ifelse(dataframe$Joyeaux == "Happy", "red", "green"),
         cex = 0.7
)