ramnathv / rMaps

Interactive Maps from R

Home Page:http://rmaps.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

display map with Shiny Rmd document?

greentheo opened this issue · comments

I've seen how you can include the maps into a shiny UI/Server setup. But I'm working with a Shiny document and RStudio server (an .Rmd file that Rstudio compiles to a shiny document.

I've got the following, but can't seem to make the example work right.

library(ggplot2)
library(plyr)
library(dplyr)
library(maps)
library(xtable)
library(lubridate)
library(knitr)
library(zoo)
library(dplyr)
library(rCharts)
library(rMaps)


inputPanel(
  selectInput("groupBy", label = "Facet By",
              choices = c("Month", "INJ_PT", "Description", "CountyState", "STATE"), selected = "STATE")
)

renderPlot({
  ggplot(data, aes(as.numeric(as.character(PaidPerGrossBbl))))+
    geom_density()+
    geom_vline(x=mean(na.omit(as.numeric(as.character(data$PaidPerGrossBbl)))))+
    facet_wrap(as.formula(paste0("~",input$groupBy)),ncol = 3)
})


renderDataTable({
      glist = list(data[[input$groupBy]])
      names(glist) = input$groupBy
      dt = aggregate(data$WTIminPaid, by = glist, function(x){mean(na.omit(as.numeric(as.character(x))))} )
      colnames(dt) = c(input$groupBy, "Avg. WTI - PricePaid")
      dt
    })


### the data is geographically based and I'll work on an rMaps chart here...
mainPanel(
      rCharts::chartOutput('myplot', 'datamaps')  
    )
output$myplot = rCharts::renderChart2({
  #an rChartsPlot
  crosslet(
    x = "country", 
    y = c("web_index", "universal_access", "impact_empowerment", "freedom_openness"),
    data = web_index
  )
})

It compiles, but just has a blank spot on the html page where the map should be.

rMaps currently does not play well with Shiny Rmd documents. This is on my list of things to do.

ah okay I see. I've been going through the documenation too for RCharts and I see that it seems rCharts does fine with Rmd,and shiny but perhaps it's similar that it doesn't play well with Shiny Rmd documents.

Thanks for the response and work on this though... rCharts and rMaps are ridiculously awesome and I'm super excited about them!