-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcanada.R
More file actions
43 lines (37 loc) · 862 Bytes
/
canada.R
File metadata and controls
43 lines (37 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
options(width=200)
df <- read.table(input_files, sep="\t", header=FALSE)
names(df) <- c(
"Abbreviation",
"Capital",
"Largest",
"Entered",
"Population",
"Land",
"Water",
"Total"
)
provinces <- subset(df, select=c("Abbreviation", "Population", "Total"))
print(provinces)
classroom <- data.frame(Abbreviation = "Classroom"
, Population=200
, Total=1e-3
)
canada <- data.frame(Abbreviation = "Canada"
, Population=sum(provinces$Population)
, Total=sum(provinces$Total)
)
pa_plot = function(dat, log=""){
par(cex=1.6)
plot(dat$Total/10000, dat$Population/1e6,
xlab = "Area (Mha)", ylab = "Population (Mp)",
type="p", pch=21, cex=1.8, bg="red",
log=log
)
}
pa_dual_plot = function(dat){
pa_plot(dat)
pa_plot(dat, log="xy")
}
pa_dual_plot(provinces)
pa_dual_plot(rbind(provinces, canada))
pa_dual_plot(rbind(provinces, canada, classroom))