DATA4207 · Data Analysis in the Social Sciences
Data Science for the Social World: R and Descriptive Statistics
Week 1 is the on-ramp: why quantitative social science answers real questions in politics, criminology, public health and economics, and how theory frames a causal question rather than being 'social science plus data'. You set up the R/RStudio and R Markdown workflow, load and clean real data, and produce descriptive statistics and first ggplot2 plots. These skills show up immediately in the weekly muddy cards and in-class quiz, and they are the descriptive-analysis backbone of every group project and the individual Research Plan and Report.
What this chapter covers
- 01Social science vs data science; quantitative social science is not 'social science + data' — subject-matter theory frames the causal question
- 02Inductive reasoning (Observation → Pattern → Theory) vs deductive reasoning (Theory → Hypothesis → test); a theory must be falsifiable
- 03The R/RStudio environment, packages and CRAN, and the R Markdown knit-to-PDF reproducible workflow
- 04Core R objects: vectors, data frames, factors, and 1-based indexing with [ ]
- 05Descriptive statistics: mean, median, mode, variance, standard deviation, range and IQR (mean(), median(), sd(), summary(), table())
- 06Operationalising an abstract concept into a measurable variable; self-report bias and survey weights
- 07Loading, cleaning and preprocessing real social-science data
- 08First ggplot2 visualisations — histograms and boxplots of a social variable
Descriptive statistics for a small survey variable
- +1Mean = (Σ xᵢ)/n = (2 + 4 + 4 + 6 + 9)/5 = 25/5 = 5 hours.
- +1Median = the middle order statistic of the sorted values 2, 4, 4, 6, 9 = 4 hours (the 3rd of 5).
- +1Sample variance s² = Σ(xᵢ − x̄)²/(n − 1) = [(2−5)² + (4−5)² + (4−5)² + (6−5)² + (9−5)²]/4 = (9 + 1 + 1 + 1 + 16)/4 = 28/4 = 7.
- +1Standard deviation s = √s² = √7 ≈ 2.65 hours. In R: mean(x), median(x), var(x), sd(x), or summary(x) for a five-number summary.
Key terms
- Vector
- A one-dimensional sequence in R whose elements are all the same type, built with c(). Operations are vectorised (adding 5 adds to every element) and indexing is 1-based, e.g. v[2] is the second element.
- Data frame
- A list of equal-length column vectors that can mix numeric and character columns — R's table of data. Access a column with df$col and a cell with df[row, column]; add a computed column with df$new <- df$a / df$b.
- Factor
- A categorical variable stored internally as integers with a levels table, which controls plotting and table order. Convert with as.factor() and set the reference level with relevel(x, ref = ...).
- Standard deviation
- The square root of the sample variance, s = √[Σ(xᵢ − x̄)²/(n − 1)] — a measure of spread in the variable's own units. In R, sd().
- Operationalisation
- Turning an abstract concept (ideology, wellbeing, trust) into a concrete, measurable variable. Poor operationalisation introduces measurement error and self-report bias.
- Falsifiable theory
- An explanation of a causal mechanism that is testable and could in principle be disproved. In this unit, theory frames the question and guides variable choice before any data is touched.
Data Science for the Social World: R and Descriptive Statistics FAQ
Do I need to know R before DATA4207?
No, but you should plan to get fluent fast. Week 1 and the pre-semester material walk through installing R/RStudio, packages and CRAN, and the R Markdown workflow, and Lab 1 has you import, clean and plot real survey data. Because every assessment is authored in R Markdown, the students who struggle are usually the ones who put off getting comfortable with vectors, data frames and ggplot2 — not those who arrive without coding experience.
What is the difference between social science and data science here?
Data science is the set of tools (statistical analysis, machine learning, NLP, network analysis) for extracting insight from data; social science is the systematic study of human behaviour and society. Quantitative social science is not simply one bolted onto the other — subject-matter theory decides which questions are worth asking and which variables and mechanisms matter, and the data-science tools then test those theory-driven claims.
How do descriptive statistics show up in the assessments?
Every group project and the Research Plan and Report open with a descriptive-analysis section: you summarise your variables (means, spreads, distributions) and plot them before any modelling. Getting summary(), sd() and a clean ggplot2 histogram or boxplot right early makes the rest of the report far easier.
Can AI help me with Week 1 material in DATA4207?
Yes, as a study aid. Sia can explain the R environment, walk you through vectors, data frames and factors, and check your descriptive-statistics calculations and ggplot2 code step by step. It teaches the method and checks your reasoning; it does not complete graded work, and University of Sydney academic-integrity rules apply — this unit does not permit generative AI on assessed work unless the coordinator says otherwise, so confirm the rule for each task on Canvas.
Assessment move
Spend Week 1 getting genuinely comfortable in R rather than memorising definitions. Reproduce Lab 1 end to end: import a real dataset, clean it, compute descriptive statistics with summary() and sd(), and draw a histogram and a boxplot in ggplot2, all inside an R Markdown file you can knit to PDF. Practise reading a distribution in words — where the centre is, how spread out it is, whether it is skewed — because that is exactly what the descriptive section of every assessment asks for. Learn the vector/data-frame/factor distinctions now; they resurface all semester. This week's ideas are tested in the low-stakes weekly quiz and muddy cards, so keep up rather than cram, and confirm lab requirements on Canvas.
Working through Data Science for the Social World: R and Descriptive Statistics in DATA4207? Sia is AskSia’s AI Statistics tutor — ask any DATA4207 Data Science for the Social World: R and Descriptive Statistics question and get a clear, step-by-step explanation grounded in how DATA4207 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.