Skip to content

Instantly share code, notes, and snippets.

@jalapic
Created March 4, 2015 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jalapic/669a52a47baacefb416c to your computer and use it in GitHub Desktop.
Save jalapic/669a52a47baacefb416c to your computer and use it in GitHub Desktop.
## app.R ##
library(shiny)
library(shinydashboard)
library(sortableR)
ui <- dashboardPage(
dashboardHeader(disable = TRUE),
dashboardSidebar(disable = TRUE),
dashboardBody(
fluidRow(
tags$div(id="veryUniqueId", class="list-group"
,tags$div(class="list-group-item", box(
title = "Hope this works", width = 3, background = "fuchsia", height=300,
"Try moving me around somewhat"
))
,tags$div(class="list-group-item", box(width=3,
title = "Filters",
sliderInput("slider", "slide me:", 1, 100, c(10,70), sep = ""),
selectInput("select", label = h4("Select Something"),
choices = list("Don't pick this one" = "op1",
"or this one" = "op2",
"pick this one"="op3"
),
selected = "op3"),
textInput("text", label = h4("Enter something"), value = "maybe")
))
,tags$div(class="list-group-item", box(title = "Some results:", width=3, status = "primary", htmlOutput("text3", height=250)))
,tags$div(class="list-group-item", box(title = "Boring plot", plotOutput("plot1", height = 300), width=3)
)
)
) ,sortableROutput( "mySort" )
)
)
server <- function(input, output) {
output$mySort <- renderSortableR({
sortableR("veryUniqueId")
})
mydata <- reactive({
runif(1000, input$slider[1], input$slider[2])
})
output$plot1 <- renderPlot({
boxplot(mydata())
})
output$text3 <- renderUI({
HTML(
paste0("Mean = ", round(mean(mydata()),2), '<br/>',
"SD = ", round(sd(mydata()),3), '<br/>'
)
)
})
}
shinyApp(ui, server)
@jalapic
Copy link
Author

jalapic commented Mar 4, 2015

This isn't quite working just yet - With this code, we can move around the boxes within a fluidrow, but they are interfering with the header bar (even though I disabled it). Not quite sure what's going on... but it does look like this will work eventually ! That would be awesome for shinydashboard enthusiasts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment