Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning message 'length(x) = 3 > 1' in coercion to 'logical(1)' #16

Closed
gavril0 opened this issue Apr 26, 2022 · 11 comments
Closed

Warning message 'length(x) = 3 > 1' in coercion to 'logical(1)' #16

gavril0 opened this issue Apr 26, 2022 · 11 comments
Assignees

Comments

@gavril0
Copy link

gavril0 commented Apr 26, 2022

After upgrading R to version 4.2 and reinstalling shiny, I get the following warning message when using timeInput:

> shiny::runApp("./shinyexamples/test/app_timeinput.R")
Warning in !is.null(y) && !is.na(y) :
  'length(x) = 3 > 1' in coercion to 'logical(1)'

Here is a simple shiny app that produces it:

library(shiny)
library(shinyTime)

ui <- fluidPage(
    timeInput("time",  "hour:min:sec)",    value = strptime("00:00:00","%H:%M:%S")),
     textOutput("text")
)
server <- function(input, output, session) {
  output$text <- renderText({ strftime(input$time) })  
} 
shinyApp(ui=ui, server=server)

The error is produced in the %AND% operator called by controlLabel()
defined in utils.R. According to R Version 4.2 Release Notes

Calling && or || with either argument of length greater than one now gives a warning (which it is intended will become an error).

> sessionInfo()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8 
[2] LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

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

other attached packages:
[1] shinyTime_1.0.1 shiny_1.7.1    

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8.3     crayon_1.5.1     digest_0.6.29    withr_2.5.0     
 [5] later_1.3.0      mime_0.12        R6_2.5.1         jsonlite_1.8.0  
 [9] lifecycle_1.0.1  xtable_1.8-4     magrittr_2.0.3   cachem_1.0.6    
[13] rlang_1.0.2      promises_1.2.0.1 jquerylib_0.1.4  bslib_0.3.1     
[17] ellipsis_0.3.2   tools_4.2.0      httpuv_1.6.5     fastmap_1.1.0   
[21] compiler_4.2.0   htmltools_0.5.2  sass_0.4.1      
@gavril0 gavril0 changed the title Warning message !is.null(y) && !is.na(y)` Warning message 'length(x) = 3 > 1' in coercion to 'logical(1)' Apr 26, 2022
@gavril0
Copy link
Author

gavril0 commented Apr 26, 2022

This warning message is also produced by shinyTime::shinyTimeExample()

@fsalemi
Copy link

fsalemi commented Jul 20, 2022

Hello @gavril0 , @burgerga
I am getting the same warning. Did you get anything back from the package owner regarding this error?
Thanks

@gavril0
Copy link
Author

gavril0 commented Jul 20, 2022

@fsalemi No, I did not. It seems that the package owner has not made any change for a while.

Note that there was a similar issue in Shiny splitLayout function with cellWidths argument that has been since fixed (I mention just in case you are using it).

@fsalemi
Copy link

fsalemi commented Jul 20, 2022

Thanks @gavril0 for the quick response.
I can live with this warning for the moment...

@burgerga
Copy link
Owner

Oof, somehow I was not notified of new issues, so I only just got an email about this issue when you mentioned me :P (and I see I have missed some other issues as well). Will try to fix this asap!

@burgerga burgerga self-assigned this Jul 20, 2022
@fsalemi
Copy link

fsalemi commented Jul 21, 2022

Thank you @burgerga for checking these issues and fixing them. I appreciate your efforts in creating such a useful package.

@burgerga
Copy link
Owner

I think I fixed it, can you try with remotes::install_github("burgerga/shinyTime")?

@burgerga
Copy link
Owner

Version 1.0.2 will be on CRAN in the near future :)

@gavril0
Copy link
Author

gavril0 commented Aug 11, 2022

For info, I tested and message does not appear. Thank you for developing
and maintaining the package.

@burgerga
Copy link
Owner

Thanks for letting me know! My pleasure :)

@fsalemi
Copy link

fsalemi commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants