I am writing an application (Shiny) that needs to check if you want to use specific data, for which you need to 1. check a box and 2. the date of the data you check should be less than 30 days ago. For this I wrote an if/else statement:
recent <- reactive({ ifelse( as.numeric(difftime(Sys.Date(), as.POSIXct(input$date) )) <= 30 && input$hist==TRUE, TRUE, FALSE ) })
where input$hist is a checkbox on a UI which has default value input$hist =FALSE and if you check the box =TRUE. And input$date is also the input from the UI which is a date. If you are not familiair with RShiny, the reactive just means that this value is automatically updated if something changes on the user interface.
I tried writing different if/else statements, with other variable values than TRUE/FALSE etc... If I only use the 30 days requirement my statement seems to work.
Error: missing value where TRUE/FALSE needed
Aucun commentaire:
Enregistrer un commentaire