Deleting rows when there are blanks in specific question

I have a dataframe which looks like the below (it is very long so have just included the head of the first 3 cols.
The Description Column ( containing DDX11L1) has some blank values. I would like to remove all rows which have a blank value in this row.

ENSG00000223972.5     DDX11L1                        0
ENSG00000227232.5      WASH7P                      187
ENSG00000278267.1   MIR6859-1                        0
ENSG00000243485.5 MIR1302-2HG                        1
ENSG00000237613.2     FAM138A                        0
ENSG00000268020.3      OR4G4P                        0 ```

I have tried 
``` counts.df.[!(counts.df.$Description == ""), ] 
counts.df[-which(counts.df$Description == ""), ]

These deletes everything in the description column
I have also tried reimporting using the na.strings="" argument and then using na.omit - this seems to convert it to an atomic vector (?) which then means I can't count the length of the column.
I have tried converting blanks to na once imported as

counts.df <- counts.df%>% na_if("") %>% na.omit

Is there anything else I can try?

I assume the column with DDX11L1, has blanks equivalent to "" and not NA_character
if so then this would work fine

library(tidyverse)

(example_data <- data.frame(good=letters[1:3],
           bad  = c("1","","3")))

(corrected_data <- filter(example_data,
                         bad != ""))

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.