I am uploading reading a text file in my shiny app. Here is how I am reading it in shiny app:
data <- reactive({
req(input$file)
df <- read.table(file=input$file$datapath[input$file$name==input$Select], skip = 15, sep=input$sep, header = input$header, stringsAsFactors = input$stringAsFactors)
updateSelectInput(session, inputId = 'xcol', label = 'X Variable',
choices = names(df), selected = names(df)[1])
updateSelectInput(session, inputId = 'ycol', label = 'Y Variable',
choices = names(df), selected = names(df)[2])
return(df)
})
Now, I want to delete/skip the rows in the uploaded dataset having empty cells.
My attempt:
df[!apply(df == "", 1, all),]
But, it is not working.
Is there a different way to do it when using read.table
?