RStudio Workbook0%
Software Skills ยท Topic 1 of 2
RStudio Workbook
Video coming soon
Theory
The question paper and the project both require you to use statistical software, and RStudio is what this course uses. It is free, and you can install it on your own computer from posit.co in a few minutes.
๐ The RStudio Workbook
There is a full interactive workbook covering everything you need: loading a dataset, descriptive statistics, boxplots, tables, histograms, scattergraphs, correlation and regression, t-tests and z-tests โ with practice datasets to download and past paper questions worked through.
Data Booklet Commands
These are the commands given to you in the exam data booklet. You are not expected to memorise them, but you must be able to choose the right one and read its output.
| Command | What it does |
|---|---|
| read.csv("file.csv") | Loads a dataset into RStudio |
| attach(file) | Makes the column headings usable as variable names |
| head(file) | Shows the first few rows โ useful for checking exact heading names |
| summary(X) | Minimum, quartiles, median, mean and maximum |
| mean(X) sd(X) median(X) IQR(X) | Individual descriptive statistics |
| table(X) | Frequency table |
| table(X, Y) | Contingency table for two categorical variables |
| prop.table(table(X))*100 | Proportions, shown as percentages |
| hist(X) | Histogram โ use it to judge the shape of a distribution |
| boxplot(X) | Boxplot; boxplot(X, Y) compares two sets |
| plot(X, Y) | Scattergraph of two numerical variables |
| cor(X, Y) | Correlation coefficient r |
| cor.test(X, Y) | Correlation hypothesis test โ gives r and a p-value |
| lm(Y ~ X) | Fits a regression line; summary(lm(Y ~ X)) adds Rยฒ |
| t.test(X, Y) | Independent t-test comparing two means |
| t.test(X, Y, paired=TRUE) | Paired t-test, for the same subjects measured twice |
| prop.test(x = c(a, b), n = c(n1, n2)) | Z-test comparing two proportions |
| detach(file) | Run at the end of a session to clear the heading names |
Remember to run your code โ Ctrl + Enter, or click Run.