How to Fix the Error in R : object not interpretable as a factor (2 Examples)

 

In this article you’ll learn how to deal with the “Error in X : object not interpretable as a factor” in the R programming language.

The content of the tutorial is structured as follows:

If you want to learn more about these topics, keep reading!

 

Example 1: Reproduce the Error in X : object not interpretable as a factor

This section shows how to replicate the “Error in X : object not interpretable as a factor”.

Have a look at the following R code:

x <- C(1, 2, 3)                     # Typo in c() function
# Error in C(1, 2, 3) : object not interpretable as a factor

As you can see, the execution of the previous R syntax has returned the “Error in X : object not interpretable as a factor”.

The reason for this is that we have misspelled the c() function – We have used an upper case C() instead of a lower case c(). Since the R programming language is case-sensitive, the error message is returned.

Let’s debug this error message!

 

Example 2: Debug the Error in X : object not interpretable as a factor

This example illustrates how to avoid the “Error in X : object not interpretable as a factor”.

For this, we simply have to spell the c function correctly:

x <- c(1, 2, 3)                     # Lower case c() function
x
# [1] 1 2 3

No errors are returned anymore!

 

Video & Further Resources

Do you need more explanations on the topics of this article? Then you could watch the following video on my YouTube channel. I show the R code of this tutorial in the video.

 

The YouTube video will be added soon.

 

Furthermore, you may read some of the related tutorials on Statistics Globe. You can find some articles below.

 

This tutorial has explained how to handle the “Error in X : object not interpretable as a factor” in the R programming language. If you have additional questions and/or comments, please let me know in the comments.

 

Subscribe to the Statistics Globe Newsletter

Get regular updates on the latest tutorials, offers & news at Statistics Globe.
I hate spam & you may opt out anytime: Privacy Policy.


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.

Menu
Top