2A Lab 4 Week 5
This is the pair coding activity related to Chapter 4.
Task 1: Open the R project for the lab
Task 2: Create a new .Rmd
file
… and name it something useful. If you need help, have a look at Section 1.3.
Task 3: Load in the library and read in the data
The data should already be in your project folder. If you want a fresh copy, you can download the data again here: data_pair_coding.
We are using the package tidyverse
today, and the datafile we should read in is dog_data_clean_wide.csv
.
Task 4: Create an appropriate plot
Pick any single or two categorical variables from the Binfet dataset and choose one of the appropriate plot choices. Things to think about:
-
Select your categorical variable(s):
GroupAssignment
,Year_of_Study
,Live_Pets
, and/orConsumer_BARK
- Decide on the plot you want to display: barchart, stacked barchart, percent stacked barchart, or grouped barchart
- You may need to convert your variables into factors
- Think about what you want to do with missing data
- Pick a colour scheme (manual or pre-defined colour palette)
- Tidy the axes labels
- Decide whether you need a legend or not, and if so, where you would want to place it
- Remove the gap between the bottom of the chart and the bars
- Pick a theme