Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ui.r
- library(shiny)
- shinyUI(fluidPage(
- titlePanel("iris data for bootstrap rcharts layout test"),
- sidebarLayout
- (
- sidebarPanel
- (
- selectInput("sp",label="choose iris species",choices=c("all","setosa","versicolor","virginica"))
- ),
- mainPanel
- (
- navbarPage(
- title="",
- tabPanel("iris_raw",dataTableOutput("table")),
- tabPanel("scatter_plot",showOutput("scatter","Highcharts"),showOutput("scatter2","Highcharts")
- ))
- )
- )
- )
- )
- #server.r
- library(shiny)
- library(rCharts)
- #Polycharts:rPlot
- #nvd3:nPlot
- #morris:mPlot
- #highcharts:hPlot
- #xCharts:xPlot
- shinyServer(function(input, output) {
- output$table <- renderDataTable({
- iris.new=iris
- if(input$sp!="all") {iris.new=iris[which(iris$Species==input$sp),]}
- iris.new
- })
- output$scatter=renderChart( #draw relationship between Sepal.Length & Sepal.Width
- {
- iris.new=iris
- if(input$sp!="all") {iris.new=iris[which(iris$Species==input$sp),]}
- a <- hPlot(x="Petal.Length",y="Petal.Width",data = iris.new,type = "scatter")
- a
- }
- )
- output$scatter=renderChart( #draw relationship between Petal.Length & Petal.Width
- {
- iris.new=iris
- if(input$sp!="all") {iris.new=iris[which(iris$Species==input$sp),]}
- a <- rPlot(x="Petal.Length",y="Petal.Width",data = iris.new[which(iris.new$Species==input$sp),],type = "point")
- a
- }
- )
- }
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement