1. Descriptive Statistics: Practical 1
Introduction
Objectives
Learn how to do the following in R
- calculate mode, mean, median and percentiles of a vector
- calculate variance and standard deviation of a vector
- make a frequency table based on raw data
Instruction
- Read through the text below
- Execute code-examples and compare your results with what is explained in the text
- Make the exercises
- Time: 60 minutes
Introduction
In this practical, you will learn how to calculate the measures of central tendency and the measures of spread in R. We will again use the gapminder dataset. Recall that the gapminder dataset is stored in a package, which you can make available in R through the following command:
library(gapminder)
Next, convert the gapminder data to a dataframe:
G <- data.frame(gapminder)
If you don't feel familiar with the gapminder dataset anymore, take a look at its contents through the functions you learned in the first practical (e.g. summary()
, str()
, head()
).
Unlock full access