I have a problem when I use renderPrint()
in combination with a .csv
file uploaded by the user and read by read_csv2()
. I always get a strange kind of indexing bar before the actual output.
When I replace read_csv2()
with base R's read.csv2()
the indexing bar disappears. Therefore, my guess is that the problem is somehow related to the fact that read_csv2()
reads the .csv
file as tibble
and not as data.frame
.
Alternatively, I also tried vroom::vroom()
, but the problem with the progress bar still remains.
In my app I would like to use either read_csv2()
or vroom::vroom()
as they are both noticeably faster than read.csv2()
.
My reprex:
library(shiny)
library(readr)
ui <- fluidPage(
fileInput(
inputId = "upload",
label = "Upload file:"
),
verbatimTextOutput("text")
)
server <- function(input, output, session) {
data <- reactive({
req(input$upload)
read_csv2(input$upload$datapath)
})
output$text <-
renderPrint({
class(data())
})
}
shinyApp(ui, server)
Output in Shiny app:
indexing 0.csv [============================================================================================] ?, eta: 0s
[1] "spec_tbl_df" "tbl_df" "tbl" "data.frame"
CodePudding user response:
The progress bar is shown by readr
package by default. You can disable them using options
.
options(readr.show_progress = FALSE)