2

I've recently started learning Shiny and am developing my first practice app. For some reason, my app doesn't take up the entire browser window but is cutoff about half way. The page can still scroll down to see the rest of the output but there is a high fold for some reason. Below is my code:

library(foreign)
library(dplyr)
library(shiny)
library(dplyr)
library(ggplot2)
library(shinythemes)

thesis <- read.csv("thesis.csv", stringsAsFactors = T)

ui <- fluidPage(theme = shinytheme("cerulean"),

  # Application title
  titlePanel("Annual Prices by City"),

  # Sidebar with choice selected
  sidebarLayout(
    sidebarPanel(
      selectInput("city","City",as.character(thesis$city)),
      tableOutput("table")
    ),

    # Show a time series line plot
    mainPanel(
      textOutput("cityheader"),
      plotOutput("plot", width="100%")

    )
  )
)


server <- function(input, output, session) {
  df <- reactive({
    thesis %>%
      select(city, year, price) %>%
      filter(city == input$city)

  })

  output$plot <- renderPlot({
    ggplot(df(), aes(x=year, y=price)) + 
      labs(title=input$city, x="Year", y="Annual Avg Price") + 
      geom_line(col="blue") 

  }, height=400, width = 700)

  output$table <- renderTable({
    df()

  })

  output$cityheader <- renderText({
    input$city
  })

}

shinyApp(ui=ui,server=server)

Here is a screenshot of the white space:

Screenshot of the Shiny App

UPDATE:

Here is what it looks like from within the viewer's pane in Rstudio:

Rstudio Screenshot

Thanks.

2
  • How does it look within Rstudio?
    – zacdav
    Jul 1, 2016 at 4:38
  • I updated with an Rstudio screenshot.
    – Easthaven
    Jul 3, 2016 at 22:37

1 Answer 1

2

I had the same issue, try

shinyApp(ui = ui, server = server, options = list(height = 1080))
1
  • That fixed it. Thanks!
    – Easthaven
    Jul 6, 2016 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.