SOCI832: Lesson 3.4. Exercise: Univariate statistics in R

Lesson 3.4: Exercise: Generating Univariate Statistics in R.


  1. Choose three variables - one dependent variable, and two independent variables - from one of the two practice datasets provided. These should be variables that have NOT been analysed in the lecture 3.3. Please choose new variables.
  2. Write R code that generates the following analysis of your three variables.
    • A descriptive statistics table with N, mean, sd, min, and max
    • A plot of the univariate statistics of one or more of the variables.
  3. Paste your code and your output (tables, text, or figures) into the Google Doc here.

Extension Exercise

  1. If you finish the above tasks, refer to the material from SOCI830, and attempt to generate the following analysis:
    • A bivariate statistical test of the relationship between each pair of the three variables (i.e. A-B, B-C, C-A)
    • A regression model of the influence of the two independent variables on the dependent variable.

Example Article + Dataset 1: Internet and Youth Political Participation (McAllister, 2016)

Ian McAllister (2016) Internet use, political knowledge and youth electoral participation in Australia, Journal of Youth Studies, 19:9, 1220-1236, DOI: 10.1080/13676261.2016.1154936


Almost since its inception, the internet has been seen as a means of reinvigorating political knowledge and engagement among the young. Early studies showed small but significant effects for internet use and increased political knowledge among the young. Using a large, national election survey conducted in Australia in 2013, this paper examines the role of the internet in shaping political knowledge among the young and, in turn, its effects on electoral participation. The results show that use of the internet during an election campaign significantly increases political knowledge among the young, and that such political knowledge enhances the likelihood of turning out to vote. Overall, the results extend the findings of other studies which have demonstrated the potential of the internet to re-engage young people into the political process.

# You can load the simplifed dataset with the following command
elect_2013 <- read.csv(url(""))

# You can load the full dataset with the following commands
# install required packages, if they aren't already installed.
if(!require(dplyr)) {install.packages("dplyr", repos='')}
if(!require(sjlabelled)) {install.packages("sjlabelled", repos='')}
if(!require(sjmisc)) {install.packages("sjmisc", repos='')}
# load required packages into memory.
# import with read_spss from the sjlablled package
full_aec_2013 <- sjlabelled::read_spss(url("")) 
# convert to 'tibble' data frame object
# 'Tibble data frames' make the data more compact and so uses up less memory on your computer.
full_aec_2013 <- as_tibble(full_aec_2013)

Example Article + Dataset 2: Corporate Political Donations (Harrigan, 2017)

Harrigan, N. M. (2017). Motives of corporate political donations: industry regulation, subjective judgement and the origins of pragmatic and ideological corporations. The British journal of sociology, 68(4), 718-753, DOI: 10.1111/1468-4446.12270


What motivates corporate political action? Are corporations motivated by their own narrow economic self-interest; are they committed to pursuing larger class interests; or are corporations instruments for status groups to pursue their own agendas? Sociologists have been divided over this question for much of the last century. This paper introduces a novel case – that of Australia – and an extensive dataset of over 1,500 corporations and 7,500 directors. The paper attempts to understand the motives of corporate political action by examining patterns of corporate political donations. Using statistical modelling, supported by qualitative evidence, the paper argues that, in the Australian case, corporate political action is largely motivated by the narrow economic self-interest of individual corporations. Firms’ interests are, consistent with regulatory environment theory, defined by the nature of government regulation in their industry: those in highly regulated industries (such as banking) and those dependent on government support (such as defence) tend to adopt a strategy of hedging their political support, and make bipartisan donations (to both major parties). In contrast, firms facing hostile regulation (such as timber or mining), and those without strong dependence on state support (such as small companies) tend to adopt a strategy of conservative partisanship, and make conservative-only donations. This paper argues that regulatory environment theory needs to be modified to incorporate greater emphasis on the subjective political judgements of corporations facing hostile regulation: a corporation’s adoption of conservative partisanship or hedging is not just a product of the objective regulation they face, but also whether corporate leaders judge such regulation as politically inevitable or something that can be resisted. Such a judgement is highly subjective, introducing a dynamic and unpredictable dimension to corporate political action.

# You can load the simplifed dataset with the following command
corp_donors <- read.csv(url(""))

Last updated on 12 August, 2019 by Dr Nicholas Harrigan (