Name:
Andrew ID:
Collaborated with:

This lab is to be done in class (completed outside of class if need be). You can collaborate with your classmates, but you must identify their names above, and you must submit your own lab as an knitted HTML file on Canvas, by Thursday 10pm, this week.

This week’s agenda: practicing split-apply-combine, getting familiar with plyr functions.

Strikes data set

Data on the political economy of strikes (from Bruce Western, in the Sociology Department at Harvard University) is up at http://www.stat.cmu.edu/~ryantibs/statcomp-S18/data/strikes.csv. The data features 18 countries of 35 years. The measured variables:

We read it into our R session below.

strikes.df = 
  read.csv("http://www.stat.cmu.edu/~ryantibs/statcomp-S18/data/strikes.csv")
head(strikes.df, 3)
##     country year strike.volume unemployment inflation left.parliament
## 1 Australia 1951           296          1.3      19.8              43
## 2 Australia 1952           397          2.2      17.2              43
## 3 Australia 1953           360          2.5       4.3              43
##   centralization density
## 1      0.3748588      NA
## 2      0.3751829      NA
## 3      0.3745076      NA

Splitting by country

Splitting by year

Many linear regressions

Plyr practice