Skip to content

Instantly share code, notes, and snippets.

Homework 5 Visualize anything with ggplot2
========================================================
In this Assignment we have used a data set from [CANSIM tables](http://www5.statcan.gc.ca/cansim/home-accueil?lang=eng&p2=50&HPA). We are going to work on the data in Table 202-0101 : Distribution of earnings, by sex, in 2011 constant dollars. This table contains 2100 series, with data for years 1976 - 2011 (not all combinations necessarily have data for all years), and was last released on 2013-06-27.
This table contains data described by the following dimensions (Not all combinations are available):
* Geography (35 items: Canada; Atlantic provinces; Newfoundland and Labrador; Prince Edward Island; ...)
* Sex (3 items: Both sexes; Males; Females)
* Earnings group (20 items: Average earnings; Median earnings; Average total income; Median total income; ...)
STAT 545A Homework #4 Visualize a Quantitative Variable
========================================================
In this assignment, we prepare ourselves to take advantage of graphical figures in data aggregation tasks. Similar to last assignment, we have used [Gapminder](http://www.stat.ubc.ca/~jenny/notOcto/STAT545A/examples/gapminder/data/gapminderDataFiveYear.txt) data.I want to emphasize that I have used the assignment #3 codes of two students: [Rebecca Johnston](http://rpubs.com/rljohn/stat545a-2013-hw03_johnston-reb) and [Jinyuan Zhang](http://rpubs.com/zhangjinyuan/stat545a-2013-hw03_zhang-jin)
## Loading the Data
We start with loading data and checking the structure of the input:
Homework #3 Data Aggregation
========================================================
In this homework we start to deal with data aggregation methods in R.
## Loading Data File
```{r}
gdURL <- "http://www.stat.ubc.ca/~jenny/notOcto/STAT545A/examples/gapminder/data/gapminderDataFiveYear.txt"
gDat <- read.delim(file = gdURL)
STAT 545A Homework 2
========================================================
## Objectives
This is a warm-up exercise for using R Markdown in making reports. To this end we have used a [Gapminder Dataset]().
## Data Loading
a <- 10
b <- -8
n <- 400
sigSq <- 0.5
set.seed(1234)
x <- runif(n)
y <- a + b * x + rnorm(n, sd = sqrt(sigSq))
(avgX <- mean(x))