Visual representation of international commerce

Author: Xavier Fernández-i-Marín
January 28, 2013 - 1 minutes
Data visualization Software

 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
44
# We need a matrix of
# origin - destination - year - % of all imports - % of all exports
  
### First we get the total of the imports and exports of each country
commerce.imp <- data.frame(tmp.imp, prop.imp)
commerce.exp <- data.frame(tmp.exp, prop.exp)

# Then, merge the datasets
commerce <- merge(commerce.imp, commerce.exp,
                  by=c("orig", "year", "dest"), all.x=T, all.y=F)


# Now, select only desired columns
commerce.processed <- data.frame(commerce$orig, commerce$dest, commerce$year,
                                 commerce$prop.imp, commerce$prop.exp)
names(commerce.processed) <- c("orig", "dest", "year", "prop.imp", "prop.exp")


n.countries <- 48
v.countries <- 1:n.countries
years <- 1948:2004


pdf(height=8.263889, width=11.68056)
par(mfrow=c(3,2))
for (o in 1:n.countries) {
  for (d in 1:n.countries) {
    if (o != d) {
      vals.imp <- prop.imp[orig==o & dest==d]
      vals.exp <- prop.exp[orig==o & dest==d]
      name.orig <- countries$nom_pais[countries$id_pais == o]
      name.dest <- countries$nom_pais[countries$id_pais == d]
      years.sel <- years
      if (length(vals.imp) == length(years.sel))
        {
          plot(years.sel, vals.imp, type="lines", col="red", lwd=1.5, ylim=c(0,1),
               main=paste(name.orig, " - ", name.dest, sep=""),
               xlab="", ylab="")
          lines(years, vals.exp, col="blue", lwd=1.5)
        }
    }
  }
}
dev.off()

Release of the CONSENSUS dataset: an opportunity for social and environmental researchers

Author: Xavier Fernández-i-Marín
March 15, 2021 - 11 minutes
Data visualization PolicyPortfolios

The COVID-19 crisis and policy change

Author: Xavier Fernández-i-Marín
May 29, 2020 - 2 minutes
What can we learn from policy research for the COVID-19 crisis
Data visualization

Creating video lessons for higher education: a tutorial on how to use OBS for teaching

Author: Xavier Fernández-i-Marín
May 7, 2020 - 9 minutes
Tutorial to create video lessons for higher education teaching: an example teaching RStudio using OBS
Data visualization
comments powered by Disqus