3.6 Creating new variables

Gapminder, States, and WVS

We now have a dataset we can work with. Depending on the dataset you are using, you may have had to select variables or filter out the data you didn’t need. We saw a quick example of how we could organize data using arrange to answer a quick question. (We will do more of this kind of thing later.)

Sometimes you want a variable that doesn’t exist in your current data set. You will need to compute it yourself. The mutate function is in the tidyverse to make this pretty easy.

Let’s watch another 10:00 video from the R Ladies Sydney walks you through using the mutate function along with arrange.

We used mutate above to recode variables. There are a lot of options here. Too many to note. We will work on these in class as needed.