How to do it...

Perform the following steps to detect the missing value:

  1. The is.na function is used to denote which index of the attribute contains the NA value. Here, we apply it to the Ozone attribute first:
         > is.na(mydata$Ozone)        Output         [1] FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE TRUE         FALSE FALSE FALSE        [14] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE         FALSE TRUE TRUE        [27] TRUE FALSE FALSE FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE         FALSE TRUE        [40] FALSE FALSE TRUE TRUE FALSE TRUE TRUE FALSE FALSE FALSE        FALSE FALSE TRUE        [53] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE FALSE        FALSE TRUE        [66] FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE TRUE        FALSE FALSE FALSE [79] FALSE FALSE FALSE FALSE TRUE TRUE ...

Get Machine Learning with R Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.