1
votes

ui.R

showOutput("applicationsClusterRChart", lib = "polycharts")

server.R

output$applicationsClusterRChart <- renderChart({ appCData<-mpg[,c("displ","cty")] clusters<-kmeans(appCData, 3) p1<-rPlot(displ~cty, data=appCData) return(p1) })

DOES not output any Chart.

And when I look at the console on the browser, it throws an error:

polychart2.standalone.js:263 Uncaught DefinitionError: Bad specification.

Any help greatly appreciated.

1

1 Answers

0
votes

You can avoid this problem by using another rCharts renderer, called renderChart2, instead of renderChart:

library(rCharts)

shinyServer(function(input, output) { 

output$app <- renderChart2({                         
      # appCData <- mpg[,c("displ","cty")] # not needed for this example
      # clusters <- kmeans(appCData, 3)    # not needed for this example

      p1 <- rPlot(displ~cty, data=mpg,type='point') 
      return(p1)
    })

})

Besides, please note that rPlot requires a plot type to be explicitly stated, otherwise it will produce an empty graph. In the example above, I used type=point.