I've coded a shiny app. It reads any input data in csv format. I've also introduced a column selector to let the user select which columns he/she wants to analyze. My problem is that I want let the user also erase missing values but when the user click 'Erase missings' it reads the data again and don't respect variable selection user has done before.
So I don't know hot to separate both operations read input data and erase missings values.
Thanks in advance!!
data1<-reactive({ fichero<-input$fichero
#Si el fichero que leemos no tiene nada devolvemos un Nulo
if (is.null(fichero))
{return()}
# Leemos el fichero
salida<-read.csv(fichero$datapath, header=input$header, sep=input$sep,quote=input$quote,stringsAsFactors=input$stringAsFactors)
# Si marcamos la opción de no missings entonces solo se tienen en cuenta los registros que no tienen ningun NA
# if (input$miss==TRUE) {salida<-salida[complete.cases(salida),]}
return(salida)
})
data<-reactive({
data1f<-data1()
salida<-data1f
# Si marcamos la opción de no missings entonces solo se tienen en cuenta los registros que no tienen ningun NA
if (input$miss==TRUE) {salida<-data1f[complete.cases(data1f),]}
return(salida)
})