Home > Mobile >  How to remove a complete row in R even if there is one missing value (empty cell)?
How to remove a complete row in R even if there is one missing value (empty cell)?

Time:08-29

I have large amount of missing value with empty cell in this dataset , I don't know how to remove it. I have tried the complete.case() function as well but that isn't working too. Can someone please help?

CodePudding user response:

Based on the screenshot, I would assume that the cells with missing values are empty strings and not NA values - and therefore aren't treated as 'missing'. You need to convert them:

cyclist_202105[cyclist_202105==""]<-NA

Another way is to handle this issue directly when importing the data via read.table() by setting the parameter na.strings="" for direct conversion.

Next time please don't link screenshots but provide any code and datasets directly as formatted text.

  •  Tags:  
  • r
  • Related