This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
options(warn=-1)
library('REmap')
library('ggmap')
## Loading required package: ggplot2
remap.init()
You can also embed plots, for example:
data = data.frame(country=mapNames('world'), value=5*sample(178)+200)
vec = c('Tokyo','Shanghai','New York','Sydney','London','Bangkok','Taipei',
'Moscow','Beijing','Washington','Lyon','Milan','Rome','Macao',
'Singapore','Hong Kong','Kuala Lumpur','Madrid','Geneva','Paris',
'Melbourne','Boston','Washington','Liverpool','Brighton','Bali',
'San Francisco','Jakarta','Ho Chi Minh','Brasilia','Barcelona',
'Rio de Janeiro','Buenos Aires','Bern','Basel','Zurich','Manila',
'Toronto','Vancouver','Budapest','New Delhi','Thimphu','Mumbai',
'Cairo','Greater Johannesburg','Durban','Alexandria','Zaria','Dubai',
'Istanbul','Mexico City','Sapporo','Osaka','Ulaanbaatar','Vienna')
## get world city geocode by ggmap
geodata = as.data.frame(cbind(geocode(vec),vec))
## design a line data.frame
markLinedata = data.frame(origin=rep('Tokyo',54),destination = vec[-2])
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.
p <- remapC(data, maptype='world',color=c('black','black'),
theme=get_theme(backgroundColor='black'),
markPointData=vec, markLineData=markLinedata, geoData=geodata)
knitrREmap(p)