shinyUI(
navbarPage('Menu',
tabPanel('Filter and Recluster',
titlePanel('Blah'),
p('Blah'),
hr(),
fluidRow(column(12, plotOutput(outputId = 'heatmap1', height = "800px"))),
hr(),
fluidRow(
column(4, checkboxInput(inputId = 'selectAllStrains',
label = 'Select/Deselect All Strains',
value = TRUE)),
column(4, checkboxInput(inputId = 'selectAllRegions',
label = 'Select/Deselect All Regions',
value = TRUE))
),
hr(),
fluidRow(
column(4, uiOutput('selectStrains')),
column(4, uiOutput('selectRegions')),
column(4, actionButton('recalculate', 'Recalculate'))
)
),
tabPanel('Plot Means and Effect Sizes',
hr()
)
)
)
jdfs = function(x) {
as.dist(1-cor(t(x)))
}
shinyServer(
function(input, output) {
# Page 1 dynamic control - select all brain regions
output$selectRegions = renderUI({
if (input$selectAllRegions == TRUE) {
checkboxGroupInput(inputId = 'regions',
label = h3('Brain Regions'),
choices = sort(colnames(testdatadf)),
selected = colnames(testdatadf))
} else {
checkboxGroupInput(inputId = 'regions',
label = h3('Brain Regions'),
choices = sort(colnames(testdatadf)),
selected = vector(mode="character", length=0))
}
})
# Page 1 dynamic control - select all mouse strains
output$selectStrains = renderUI({
if (input$selectAllStrains == TRUE) {
checkboxGroupInput(inputId = 'strains',
label = h3('Mouse Strains'),
choices = sort(rownames(testdatadf)),
selected = rownames(testdatadf))
} else {
checkboxGroupInput(inputId = 'strains',
label = h3('Mouse Strains'),
choices = sort(rownames(testdatadf)),
selected = vector(mode="character", length=0))
}
})
# Page 1 plot - heatmap for reclustering
output$heatmap1 = renderPlot({
input$recalculate
# isolate() prevents heatmap from regenerating every time a new strain/region is selected
testdatadfmat = as.matrix(testdatadf[isolate(input$strains), isolate(input$regions)])
nr = dim(testdatadfmat)[1]
nc = dim(testdatadfmat)[2]
if (dim(testdatadfmat)[1] > 1 & dim(testdatadfmat)[2] > 1) {
heatmap.2(x=testdatadfmat,
distfun=jdfs,
#hclustfun=hclust.avg,
col=bluered,
margins=c(20,14),
trace='none',
cexRow=1.5,
cexCol=1.5,
density.info='histogram',
keysize=0.8,
symkey=TRUE,
symbreaks=TRUE)
}
}, height=800)
}
)
require(gplots)
require(shiny)
# simulate mousedata
testdata = rep(x=-5:5, each=1, times=10)
testdatadf = as.data.frame(matrix(testdata, nrow=10, ncol=10))
runApp(appDir=<directory containing the above files>, launch.browser=TRUE)
titlePanel('Blah'),
p('Blah'),
hr(),
System specs: Mozilla Firefox 37.0.1, Ubuntu 12.04.4, 64-bit
Hello,
When I lauchn your app, it displays that 'testdatadf' object is unfindable.
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/57bdf8d1-a8e7-4e0b-b911-f6be70acb333%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/2df3654e-9a61-4648-9b44-1c209e10eb8a%40googlegroups.com.