olympics | R Documentation |
Final medal count, by country, for the Summer 2008 and 2012 Olympic Games.
data(olym08)
data(olym12)
A data frame with 87 or 85 observations on the following 6 variables.
rank
a numeric vector, overall ranking of the countries.
country
a factor.
gold
a numeric vector, number of gold medals.
silver
a numeric vector, number of silver medals.
bronze
a numeric vector, number of bronze medals.
totalmedal
a numeric vector, total number of medals.
The events were held during (i) August 8–24, 2008, in Beijing; and (ii) 27 July–12 August, 2012, in London.
The official English website
was/is http://en.beijing2008.cn
and http://www.london2012.com
.
Help from Viet Hoang Quoc is gratefully acknowledged.
grc
.
summary(olym08)
summary(olym12)
## maybe str(olym08) ; plot(olym08) ...
## Not run: par(mfrow = c(1, 2))
myylim <- c(0, 55)
with(head(olym08, n = 8),
barplot(rbind(gold, silver, bronze),
col = c("gold", "grey", "brown"), # No "silver" or "bronze"!
# "gold", "grey71", "chocolate4",
names.arg = country, cex.names = 0.5, ylim = myylim,
beside = TRUE, main = "2008 Summer Olympic Final Medal Count",
ylab = "Medal count", las = 1,
sub = "Top 8 countries; 'gold'=gold, 'grey'=silver, 'brown'=bronze"))
with(head(olym12, n = 8),
barplot(rbind(gold, silver, bronze),
col = c("gold", "grey", "brown"), # No "silver" or "bronze"!
names.arg = country, cex.names = 0.5, ylim = myylim,
beside = TRUE, main = "2012 Summer Olympic Final Medal Count",
ylab = "Medal count", las = 1,
sub = "Top 8 countries; 'gold'=gold, 'grey'=silver, 'brown'=bronze"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.