data("nuts2006")
## Example 1
nuts2.df$unemprate <- nuts2.df$unemp2008/nuts2.df$act2008*100
choroLayer(spdf = nuts2.spdf,
df = nuts2.df,
var = "unemprate")
## Example 2
nuts2.df$unemprate <- nuts2.df$unemp2008/nuts2.df$act2008*100
choroLayer(spdf = nuts2.spdf,
df = nuts2.df,
var = "unemprate",
method = "quantile",
nclass = 8,
col = carto.pal(pal1 = "turquoise.pal", n1 = 8),
border = "grey40",
add = FALSE,
legend.pos = "topright",
legend.title.txt = "Unemployement rate\n(%)",
legend.values.rnd = 1)
## Example 3
# Compute the compound annual growth rate
nuts2.df$cagr <- (((nuts2.df$pop2008 / nuts2.df$pop1999)^(1/9)) - 1) * 100
summary(nuts2.df$cagr)
# Plot the compound annual growth rate
cols <- carto.pal(pal1 = "blue.pal", n1 = 2, pal2 = "red.pal", n2 = 4)
choroLayer(spdf = nuts2.spdf,
df = nuts2.df,
var = "cagr", breaks = c(-2.43,-1,0,0.5,1,2,3.1),
col = cols,
border = "grey40",
add = FALSE,
legend.pos = "topright",
legend.title.txt = "Compound annual\ngrowth rate",
legend.values.rnd = 2)
# Layout plot
layoutLayer(title = "Demographic Trends",
sources = "Eurostat, 2008",
scale = NULL,
frame = TRUE,
col = "black",
coltitle = "white")
Run the code above in your browser using DataLab