0

When I run the app below and press the Go button, the R session crashes with this error:

Warning : Error in &&: 'length = 3' in coercion to 'logical(1)'
  3: runApp
  2: print.shiny.appobj
  1: <Anonymous>
  library(shiny)
  library(shinyalert)

  shinyApp(
    ui = fluidPage(
      actionButton("btn", "Go")
    ),
    server = function(input, output) {
      observeEvent(input$btn, {
        shinyalert(
          html = TRUE,
          text = tagList(
            numericInput("num", "Number", 10),
            "The square of the number is",
            textOutput("square", inline = TRUE)
          )
        )
      })

      output$square <- renderText({ input$num*input$num })
    }
  )
> sessionInfo()
R version 4.3.0 (2023-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 20.3

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=fr_BE.UTF-8       LC_NUMERIC=C               LC_TIME=fr_BE.UTF-8       
 [4] LC_COLLATE=fr_BE.UTF-8     LC_MONETARY=fr_BE.UTF-8    LC_MESSAGES=fr_BE.UTF-8   
 [7] LC_PAPER=fr_BE.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=fr_BE.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/Brussels
tzcode source: system (glibc)

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

other attached packages:
[1] shinyalert_3.0.0 shiny_1.7.4     

loaded via a namespace (and not attached):
 [1] crayon_1.5.1     cli_3.6.1        knitr_1.42       rlang_1.1.1      xfun_0.39        promises_1.2.0.1
 [7] jsonlite_1.8.4   xtable_1.8-4     htmltools_0.5.5  httpuv_1.6.5     sass_0.4.6       jquerylib_0.1.4 
[13] ellipsis_0.3.2   fastmap_1.1.1    lifecycle_1.0.3  memoise_2.0.1    compiler_4.3.0   Rcpp_1.0.10     
[19] rstudioapi_0.14  later_1.3.0      digest_0.6.31    R6_2.5.1         commonmark_1.9.0 magrittr_2.0.3  
[25] bslib_0.4.2      uuid_1.1-0       tools_4.3.0      withr_2.5.0      mime_0.12        xml2_1.3.4      
[31] cachem_1.0.8    
Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225
  • I found the error by looking at the code but it's strange since this is an example given in the package. ``` text = tagList( numericInput("num", "Number", 10), "The square of the number is", textOutput("square", inline = TRUE) ) ``` In the code there is `html && nzchar(text)`. And: ```r nzchar(text) # TRUE TRUE TRUE ``` – Stéphane Laurent May 20 '23 at 11:06
  • I reported the bug now. – Stéphane Laurent May 21 '23 at 07:58

0 Answers0