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

YouTube

By loading the video, you agree to YouTube’s privacy policy.
Learn more

Load video

Leave a Reply

Your email address will not be published.

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