Working in small groups or pairs, complete the following exercises.

Required Packages

The following packages will be required or may come in handy.

library(readr)
library(xlsx)
library(readxl)
library(foreign)
library(gdata)
library(rvest)

Exercises

  1. Display your working directory using getwd() command.

  2. Create a folder and name it “Week2” on your desktop and set this as your working directory. (Hint: You can set your working directory using setwd() command.)

Population Data

The following exercises (exercise 3-5) are based on Population density and regional dataset (population.csv) which contains 2245 rows of time series data between 2009 to 2016. This data is taken from OECD located at http://stats.oecd.org/Index.aspx?DataSetCode=REGION_DEMOGR where you can find more about the data structure. The variables for population.csv dataset consists of:

Region [Character]: Region name

Territory Level and Typology [Factor]: Description of the region (Country, Large regions, Small regions,… )

2009, 2010, ...,2016 [Numeric]: Population density growth index per referenced time.

  1. Import csv version of Population dataset (population.csv) using Base R functions.

  2. Repeat exercise 3, this time use readr functions.

  3. Import spss version of Population data (population.sav) using foreign package.

Population - Migration Data

Exercise 6 is based on population-migration dataset (population-migration.xls) which contains two sheets named “Population Density and Regional” and “Inter-regional Migration” in .xls format. “Inter-regional Migration” sheet contains 1564 rows of timeseries data between 2009 to 2016. This data set is also taken from OECD located at http://stats.oecd.org/Index.aspx?DataSetCode=REGION_DEMOGR. The variables for population-migration data (“Inter-regional Migration” sheet) contains:

Region [Character]: Region name

Territory Level and Typology [Factor]: Description of the region (Country, Large regions, Small regions,… )

2009, 2010, ...,2016 [Numeric]: Migration (All persons inflows minus outflows)

  1. Import population-migration dataset (population-migration.xls) using readxl functions. (Hint: Use sheet argument.)

List of Cities in Australia by Population Data Table

The following exercise is based on the html data table taken from Wikipedia located at https://en.wikipedia.org/wiki/List_of_cities_in_Australia_by_population containing following variables:

RANK [Integer]: Rank

GCCSA/SUA [Character]: Greater Capital City Statistical Areas/Significant Urban Areas

State/Territory [Character]: State/Territory names

June 2016[2] population [Numeric]: Population

Percentage of national population [Character]: Ratio of the population as a percentage

  1. Using the html link for Cities in Australia by Population, import the data table and save it to your working directory which you set up previously.


Finished?

If you have finished the above tasks, work through the weekly list of tasks posted on the Canvas announcement page.

Return to Course Website