Skip to content

Instantly share code, notes, and snippets.

@pssguy
Last active December 19, 2015 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pssguy/6025420 to your computer and use it in GitHub Desktop.
Save pssguy/6025420 to your computer and use it in GitHub Desktop.
googleCharts in Shiny
library(googleCharts)
library(googleVis)
library(shiny)
shinyServer(function(input, output, session) {
# this works
output$scatter1 <- reactive({
names(women) #[1] "height" "weight"
list(
data = googleDataTable(
women
)
)
})
# correct column reference required
output$scatter2 <- reactive({
age <- c(20:34)
women <- cbind(women,age)
names(women) #[1] "height" "weight" "age"
list(
data = googleDataTable(
women
)
)
})
})
shinyUI(basicPage(
googleChartsInit(),
googleScatterChart('scatter1', width='350px', height='300px'),
googleScatterChart('scatter2', width='350px', height='300px')
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment