Setting width of renderPrint area


How can one set the width of the print area created by renderPrint and displayed using verbatimTextOutput? The width option of renderPrint seems to do nothing, as modifying the options()$width value.

Any suggestions is greatly appreciated.



# Global variables can go here
df <-, nrow = 1))
names(df) <- paste0(V, 1:ncol(df))

# Define the UI
ui <- bootstrapPage(
    inputId = 'width',
    label = 'Width',
    value = 100,
    min = 50,
    max = 400,
    step = 10

# Define the server code
server <- function(input, output) {
  output$printArea <- renderPrint(
      #options(width = input$width)
      cat(sprintf('Width: %s\n\n', input$width))
    width = input$width

# Return a Shiny app object
shinyApp(ui = ui, server = server,options = list(launch.browser = TRUE))

My current configuration:

R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 19.3

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/

 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shiny_1.5.0

loaded via a namespace (and not attached):
 [1] compiler_3.6.3  fastmap_1.0.1   magrittr_1.5    R6_2.4.1        promises_1.1.0  later_1.0.0     htmltools_0.5.0 tools_3.6.3    
 [9] Rcpp_1.0.4.6    jsonlite_1.6.1  digest_0.6.25   xtable_1.8-4    httpuv_1.5.4    mime_0.9        rlang_0.4.6 

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.