Cleaning and setting up the data
Setting up the data for this example is straightforward. We will load the data, correctly label missing values, and create some new variables for our analysis. Before we start, make sure the data.csv
file is in the same directory as the code you're working with, and that your working directory is properly setup. If you don't know how to do so, setting up your working directory is quite easy, you simply call the setwd()
function passing the directory you want to use as such. For example, setwd(/home/user/examples/)
would use the /home/user/examples
directory to look for files, and save files to.
If you don’t know how to do so, setting up your working directory is quite easy, you simply call the setwd()
function passing the directory you want to use as such. For example, setwd(/home/user/examples/)
would use the /home/user/examples directory to look for files, and save files to.
We can load the contents of the data.csv
file into a data frame (the most intuitive...