# Check whether a Vector Object is Empty in R (Example Code)

In this tutorial you’ll learn how to evaluate whether a vector object is empty in R programming.

## Creation of Example Data

x <- vector() # Constructing an empty example vector x # logical(0) |

x <- vector() # Constructing an empty example vector x # logical(0)

## Example: Checking whether Vector is Empty Using the length() Function

length(x) == 0 # Return indicator if vector is empty # [1] TRUE |

length(x) == 0 # Return indicator if vector is empty # [1] TRUE