## Not run:
# ### Directory of the package with flags
# dirflags = paste(searchpaths()[grep("sparkTable", searchpaths())], "/etc/Flaggen/",
# sep="")
# ### EXAMPLE for EUROPE
# data(EU_data)
# order_eu = optimal_grid_allocation(EU_data[,16:17],8,7)
# colnames(EU_data)[1] <- c("country")
# EU_data[,18] <- order_eu
# colnames(EU_data)[1] <- c("country")
# colnames(EU_data)[18] <- c("order")
# data_eu = data.frame(cbind(rep(1997,34)), EU_data$unempl_f_1997, EU_data$country,
# EU_data$order)
# colnames(data_eu) = c("x", "y", "names", "order")
# for(year in 1998:2008){
# XX <- data.frame(cbind(rep(year,34)), EU_data[,paste("unempl_f_",year,sep="")],
# EU_data$country, EU_data$order)
# colnames(XX) = c("x", "y", "names", "order")
# data_eu = rbind(data_eu,XX)
# }
# dirflags_eu=paste(dirflags,"EU/",sep="")
# checkerplot(data_eu, cols=8, rows=7, geom="line", img=dirflags_eu,
# title = "Unemployment rate in Europe 1997 to 2008 (in perc)", title.size=18,
# ylabels=c(5,10,15,20),
# ybreaks=c(5,10,15,20), xbreaks=c(1998,2001,2004,2007),
# xlabels=c("98","01","04","07"),
# margin_yaxis=-0.05, margin_yaxis2=-0.2,
# margin_xaxis=-0.4, margin_xaxis2=0 )
#
# ### EXAMPLE for US data
# data(coordUS)
# ## rearrange states which are far away:
# coordUS[coordUS$state=="AK","x"] <- 0.4 ## rearrange Alaska
# coordUS[coordUS$state=="HI","x"] <- 0.5 ## rearrange Hawaii
# ## optimal arrangement of the states:
# order <- optimal_grid_allocation(coordUS[,1:2],13,6)
# order <- data.frame(names=coordUS$state,order=order)
# ## load US healthy insurance data
# data(USdata1)
# data(USdata2)
# nam <- names(USdata1)
# ## delete previous order (optional)
# USdata1 <- USdata1[,-which(names(USdata1)=="order")]
# ## combine data and ordering:
# USdata1 <- merge(USdata1,order,all.x=TRUE,all.y=FALSE)
# # USdata1[is.na(USdata1$order),"order"] <- 14
# USdata1 <- USdata1[,nam]
# ## define directory with flags (pnm's):
# dirflags_us=paste(dirflags,"USStates/",sep="")
# USdata2[,3] <- USdata2[,3]*100
# checkerplot(USdata2[,-2], cols=13, rows=6, geom="bar",
# title="US private health insurance (in percent of the population)",
# title.size=18, ylabels=c(30,60,90), ybreaks=c(30,60,90),
# img=dirflags_us, margin_yaxis=-0.05, margin_yaxis2=-0.2,
# margin_xaxis=-0.4, margin_xaxis2=0)
# ## End(Not run)
Run the code above in your browser using DataLab