Skip to content

Instantly share code, notes, and snippets.

@yoavram
Created November 9, 2012 13:54
Show Gist options
  • Save yoavram/4045750 to your computer and use it in GitHub Desktop.
Save yoavram/4045750 to your computer and use it in GitHub Desktop.
Shiny app of a Random Graph Plot. Requirements: Shiny (http://www.rstudio.com/shiny/) and Rgraphviz (http://www.bioconductor.org/packages/2.11/bioc/html/Rgraphviz.html). This app is deployed at http://glimmer.rstudio.com/yoavram/RandomGraphPlot/
library(shiny) # http://rstudio.github.com/shiny/tutorial/#hello-shiny
library(Rgraphviz) # http://www.bioconductor.org/packages/2.11/bioc/html/Rgraphviz.html
shinyServer(function(input, output) {
output$graphPlot <- reactivePlot(function() {
g <- randomGraph(1:input$V, 1:input$M, input$p)
plot(g)
})
})
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Shiny Random Graph"),
sidebarPanel(
sliderInput("V",
"Number of nodes:",
min = 1,
max = 100,
value = 10),
sliderInput("M",
"M:",
min = 1,
max = 10,
value = 4),
sliderInput("p",
"p:",
min = 0,
max = 1,
value = 0.5),
helpText("Code available at https://gist.github.com/4045750")
),
mainPanel(
plotOutput("graphPlot")
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment