Find Missing Values in R (Example)

This page explains how to find missing values in a vector or data frame column in the R programming language.

Example Data

vec <- c(8, 1, 5, 3, NA, 5, NA, 3) # Create example data

Identify Position of NA Values in Vector

We can use the which() and is.na() functions to identify the index of each missing value:

which(is.na(vec))                  # Find NA values in vector
# 5 7

Example Video

You are currently viewing a placeholder content from YouTube. To access the actual content, click the button below. Please note that doing so will share data with third-party providers.

More Information

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top