Sunday, February 23, 2014

Displaying discrete data in R

Suppose you have a restaurant, and you do a survey where your customers can grade from 1 to 5 several aspects of that restaurant. The 1st 5 lines on your data will look something like:

Food Drinks Location Service
1 4 2 5 5
2 4 3 5 4
3 5 4 5 4
4 3 3 5 4
5 4 2 5 3

To analise this data, what I would usually do is check the mean, standard deviation, maybe do some histograms, and maybe do a boxplot of the data.


But when you have small amounts of data, these approaches tend to hide the story. An alternative option is to use a beeswarm chart:

This type of chart shows the entire dataset, allowing you to see everything at a glance!

If you're using R, you can create these charts using the beeswarm package. You can find the code that built this chart here (it also uses the reshape package).

No comments: