'Why is reactive dataset, in RShiny, with NA value considered as "empty" dataset in validation?
Can somebody help me please? In my application, the user can upload a file from the device. The application has a number of features that do not matter now. The point is that when performing validation is reactive dataset, in RShiny, with NA value considered as "empty" dataset and "warning message" does not disappear despite the uploaded dataset. Is there some way how to resolve it ? (In my example: After upload dataset with NA value there is still message Please, upload dataset at first! )
SERVER:
##########################################
#dataset upload
df1 <- reactiveVal()
observeEvent(input$file1,{
df <- read.csv(input$file1$datapath,
header = input$header,
sep = input$sep,
quote = input$quote)
df1(df)
})
##########################################
##########################################
#example of function where I use validation
#Delete column
output$to_delete<- renderUI({
validate(
need(df1() != "", "Please, upload dataset at first!")
)
choice <- names(df1())
selectInput('to_delete', label = 'Choose column to delete: ', choices = choice)
})
observeEvent(input$del_col, {
df1(df1()[ , !names(df1()) %in% c(input$to_delete)])
})
##########################################
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
