See code below. As it is works. If you un-comment the commented-out lines shiny drops the legend. It may well be a shiny bug. My app needs navbarPage. Anybody has any suggestion?? I use R version 3.1.1 & latest versions of packages (as of 6/10/2014)
library(WDI)
library(dplyr)
library(countrycode)
library(RColorBrewer)
library(plyr)
library(rMaps)
library(rCharts)
library(shiny)
#
runApp(list( ui =
# navbarPage("Maps", id = "maps",
# footer = "footer",
tabPanel("Data Map", id="overview",h3("Data Maps!"),
showOutput("chart1", "datamaps")
# )
),
server = function(input, output, session) {
output$chart1 <- renderChart2({
df=WDI(country = "all", indicator = "SH.DYN.MORT",
start = 2000, end = 2000, extra = FALSE, cache = NULL)
data <- df %.%
na.omit() %.%
mutate(iso3c=countrycode(iso2c, "iso2c", "iso3c")) %.%
group_by(iso3c)
i1 <- ichoropleth(SH.DYN.MORT~iso3c, data, map="world",labels=FALSE,pal="Reds")
i1
})
}))
library(rMaps)as well. - Joe Cheng