Created
May 7, 2015 03:44
-
-
Save pbiecek/0617b36500f95daa3a00 to your computer and use it in GitHub Desktop.
ShinyExample
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(shiny) | |
| library(PogromcyDanych) | |
| # wykonywane raz gdy uruchamiana jest plikacja | |
| serialeIMDB$sezon <- paste(serialeIMDB$sezon, serialeIMDB$odcinek, sep="/") | |
| shinyServer(function(input, output) { | |
| # reużywalny fragment | |
| dane <- reactive({ | |
| serialeIMDB[serialeIMDB$serial == input$serial, | |
| c("id", "serial", "nazwa", "sezon", "ocena", "glosow")] | |
| }) | |
| # odpowiedź na kontrolki | |
| output$tabela <- renderTable({ | |
| dane() | |
| }) | |
| output$wykres <- renderPlot({ | |
| tmp <- dane() | |
| ggplot(tmp, aes(x=id, y=ocena)) + | |
| geom_point() + geom_smooth(se=FALSE) | |
| }) | |
| output$podsumowanie <- renderPrint({ | |
| tmp <- dane() | |
| summary(tmp[,c("ocena", "glosow")]) | |
| }) | |
| }) | |
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(shiny) | |
| library(PogromcyDanych) | |
| shinyUI(fluidPage( | |
| titlePanel("Eksplorator seriali"), | |
| sidebarLayout( | |
| sidebarPanel( | |
| selectInput("serial", | |
| "Wybierz serial", | |
| levels(serialeIMDB$serial), | |
| "Friends") | |
| ), | |
| mainPanel( | |
| p("Dane dotyczące wybranego serialu:"), | |
| br(), | |
| tabsetPanel( | |
| tabPanel("Wykres", plotOutput("wykres", width = 500)), | |
| tabPanel("Podsumowanie", verbatimTextOutput("podsumowanie")), | |
| tabPanel("Tabela", tableOutput("tabela")) | |
| ) | |
| ) | |
| ) | |
| )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment