Missing values are part of the data-manipulation process, and we will encounter some missing values in almost every dataset. So, it is important to know how R handles missing values and how they are represented. In R, a numeric missing value is represented by
NA, while character missing values are represented by
<NA>. To test if there is any missing value present in a dataset (data frame), we can use
is.na() for each column; alternatively, we can use this function in combination with the
The following example shows whether there is any missing value present in a dataset:
> missing_dat <- data.frame(v1=c(1,NA,0,1),v2=c("M","F",NA,"M")) > missing_dat v1 v2 1 1 M 2 NA F 3 0 <NA> 4 1 M > is.na(missing_dat$v1)  ...