Menu

NAs are part of data… like it or not :). This entry will utilize both Dplyr and Base R functionality to remove NA from the dataset.

Suppose you have the following dataset with NAs in 2 columns.

Case 1: Specifying a Column as a Criterion

We will use GPA as a criterion for removing NA. If there is NA in GPA column, we will remove the row.

The fifth row is now excluded.

Case 2: Specifying Multiple Columns as Criteria

We will use GPA and Grade columns as criteria.

The fourth and fifth rows are excluded.

Case 3: Remove all NAs from the dataset

Specifying the name in filter works just fine, what if we have 90 columns and each column has NAs? It will be too troublesome to type all 90 columns.