Exercise
Load the pre-installed dataset lifeexp.
- Aggregate the dataset to the means of population growth, life expectancy, GNP p.c., and access to safe water. List the observations.
- Re-load the dataset. Aggregate the dataset by region, using the minimum, median, and maximum value for GNP p.c. and creating a variable indicating how many observations per regions are used. List the observations.
- Re-load the dataset. Aggregate the data as in (2), and create a bar graph of the minimum, median, and maximum GNP p.c. by region. This time, make sure that the initial data is restored afterwards, such that you can display summary statistics for all variables of the initial dataset.
- Re-load the dataset. Generate a categorical variable which groups the observations by GNP p.c. (use the left-hand boundaries 0, 5000, 10 000, 40 0000). Aggregate the dataset by region and the new variable, using mean GNP p.c. List the observations. What do you notice?