Rstudio resets width option when running shiny app in Viewer

When I run a shiny app in the Rstudio Viewer options(width = ...) is reset by Rstudio. When I set options(width = 250) in global.R this seems to be ignored completely. Is there a way to change this behavior in Rstudio?

Also, Viewer seems to ignore CSS for handling overflow (see below). The CSS does work in Chrome and Firefox.

pre, code, pre code {
  overflow: auto;


It seems options(width = ...) is actually reset when you change the width of the Viewer window. As an example, if you open the app below in Viewer and change the size of the Viewer window getOption("width") will not return 250


options(width = 250)

# Define UI for application that draws a histogram
ui <- fluidPage(
  tags$head(tags$style(HTML("pre { overflow: auto; }"))),

# Define server logic required to draw a histogram
server <- function(input, output) {
   output$df <- renderPrint({
     data.frame(matrix(1:60, ncol = 60))

# Run the application 
shinyApp(ui = ui, server = server)


Better example posted to GitHub @

1 Like