Last active
December 19, 2015 22:09
-
-
Save pssguy/6025420 to your computer and use it in GitHub Desktop.
googleCharts in Shiny
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
) | |
) | |
}) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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