Lesson 6: Working with Two Variables

Overview Section

In this chapter we'll start working with more than one variable, using Chapter 6 in Essential R, and it will (hopefully) start to feel more like we are actually doing statistics. Note that while we'll introduce plotting functions a bit more here, we're just scratching the surface - in later chapters we'll go into plotting in much greater depth.


Upon completion of this lesson, you should be able to:

  • Make frequency table and carry out chi-squared test for 2 factors
  • Make barplots for 2 factors
  • Explore correlation between 2 numeric variables
  • Fit a regression between 2 numeric variable
  • Compare group means for a continuous variable over levels of a factor

Data and R Code Files Section

As always, you can access these files in the "Code Files" folders available from the Essential R page, of here: Chapter 6.R (R script)