interactive ggplot with tooltip using plotly

tldr: wrap ggplotly around ggplot and add info in aes()

A quick Random R thing I use a lot, recently learned, and I want you to know it too. In this post I’ll show you how to make a quick interactive plot with ggplot and plotly, so that values are displayed when you hover your mouse over it. Why would you want this? If you are exploring the data, you want some quick insights into which values are where. [Read More]

Arthur blinked, Ford shrugs, but Zaphod leapt; text as graph

Text can be interpreted as a graph

Can we make the computer say something about characters in a book? In this piece I will search for the names of characters and the words around those names in books. What can we learn about a character from text analysis? Of course it’s also just another excuse for me to read the Hitchhikers series! I will break down the text into chunks of two words, extract the word pairs that matter and visualize the results. [Read More]

Reading in an epub (ebook) file with the pubcrawl package

In this tutorial I show how to read in a epub file (f.i. from your ebook collection on you computer) into R with the pubcrawl package. In emoji speak: 🍺📖📦 . I will show the reading in part, (one line of code) and some other actions you might want to perform on textfiles before they are ready for text analysis. After you read in your epub file you can do some cool analyses on it, but that is part of the next blogpost. [Read More]

If blogging was like academia, we would all be saved, thank you for your edits.

A month ago I posted a short piece inspired by a post by Maële Salmon She actually reached out to me in 10 minutes, telling me I made a weird spelling error (no excuses, I really make those a lot). Then a day or two later Jon Spring walked through the code and realized that I switched two outcomes in the code. Just about 10 days ago I posted about downloading multiple files and Mara Avarick noticed a weird ‘<<<<<<’ sign on my website. [Read More]

Turning kindle notes into a tidy data

It is my dream to do everything with R. And we aRe almost there. We can write blogs in blogdown or bookdown, write reports in RMarkdown (thank you Yihui Xie!) create interactive webpages with Shiny (thank you Winston Chang). Control our lifx lights with lifxr (great work Carl!) and use emoticons everywhere with the emo package. There is even a novel of my vision! I recently found chapter 40 of A Dr. [Read More]

Introduction to R projects

It often makes sense to separate your projects. And since space is cheap you are probably creating separate folders on your computer. In RStudio you can create different projects that live in their own folder. When you start a different project the files of that project work independently from other projects. And the standard locations of your workspace and other things are also separated from the rest. In my case, for example, I have several projects and the last 10 or so are displayed in the dropdown menu: [Read More]

From spss to R, part 4

This is the second part of working with ggplot. We will combine the packages dplyr and ggplot to improve our workflow. When you make a visualisation you often experiment with different versions of your plot. Our workflow will be dynamic, in stead of saving every version of the plot you created, we will recreate the plot untill it looks the way you want it. In the previous lesson we worked with some build in datasets. [Read More]

From spss to R, part 3

In this post we will start with a build-in dataset and some basic ggplot graphics. In the next post we will combine dplyr and ggplot to do awesome stuff with the Dutch University student counts from the previous lessons. We will work with the build-in dataset mtcars. There are many datasets in r library(help = "datasets") but in many examples online you will see the iris and mtcars examples. Find more information about the dataset with ? [Read More]

Version control with Git

Keeping track of versions You work on a project and would like to keep track of what you did. That is why keep old versions of your files. That way you can go back if you messed up beyond recognition. Usually that looks like this: Or you use dropbox or something like it: Other people use email. Emailing to themselves or to collaborators when they finished something. [Read More]

Tidying your data

Introduction To make analyses work we often need to change the way files look. Sometimes information is recorded in a way that was very efficient for input but not workable for your analyses. In other words, the data is messy and we need to make it tidy. Tidy data means 1: Each variable forms a column. Each observation forms a row. Each type of observational unit forms a table. [Read More]