Chapter 14 DIY

Now its time for you to explore some data on your own. Either use some of your own data, or use one of the datasets that freely available to use in R. The main list is here. You can check whether you will need to install a package to acess a dataset. For instance, if you want to use the dataset named ‘TitanicSurvival’ you can proceed as follows:


Alternatively, try to load your data in R. If using spps files remeber you can load .sav files using package foreign. Apply the skills that you’ve gained from today to the data. There are some pointers below to get you started.

# create new script 
# read in data and familiarise yourself with it
# load any necessary packages
# check variable types
# clean data if necessary (i.e. are there any missing values? any variables need to be renamed?)
# re-level data and label if appropriate
# produce some descriptive statistics
# create some basic exploratory plots and more advanced ggplots to visualise your data
# save the script and the plots

If keen to try some fancier graphics, have a look at this amazing ggplot gallery.

Quick note: it may feel a bit frustrating at the beginning to get acustomed to R. Yet, trust out experience, we all have been there. Stay patient, keep going! The joy of getting your code run always worth it!