Identify Non-Numeric Values in Vector or Data Frame Column in R (Example Code)

In this article, I’ll show how to check for non-numeric values in a data object in the R programming language.

Creation of Example Data

my_data <- c("a", 2, 55, "xxx", 7, 8, "6,3")    # Example vector in R
my_data                                         # Display example vector in RStudio
# [1] "a"   "2"   "55"  "xxx" "7"   "8"   "6,3"

Example: Check for Non-Numeric Values Using as.numeric() Function

# [1] "a"   "xxx" "6,3"

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