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]
From spss to R, part 2
Introduction In this lesson we will open a .sav file in Rstudio and manipulate the data.frame. We will select parts of the file and create some simple overviews. First time with R? No problem, see lesson 1
toc {:toc} Download a .sav (SPSS) file I downloaded the following dataset from DUO (Dienst uitvoering onderwijs): [Aantal wo ingeschrevenen (binnen domein ho)][3]. This dataset has a cc0 declaration, which means it is in the public domain and we can do anything we want with this file.
[Read More]
From spss to R, part 1
Introduction This whole blog is devoted to R and clean coding in R. But what if you want to start with R? There are millions of websites devoted to learning R. just look at the number of hits on a certain search machine. Most of these hits start with the basics and slowly work your way up to more advanced examples.
There is often one reason to start with R: you want to achieve something that doesn’t work in other programs.
[Read More]