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.
- predict Error in eval(predvars, data, env) : numeric ‘envir’ arg not of length one
- Error in as.POSIXlt.character : string not standard unambiguous format
- Error: Object of Type Closure is not Subsettable
- Error in read.table: duplicate ‘row.names’ are not allowed
- Dealing with Warning & Error Messages in R
- Introduction to R Programming
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.
8 Comments. Leave new
This is very helpful, thank you.
I mistakenly used upper C to concatenate
Hey Solomon,
Thank you for the kind comment, glad it was helpful!
Regards,
Joachim
Very helpful to beginner.
Thank you very much, glad you think so!
Regards,
Joachim
Thanks man! This is very helpful!
Hello Michael,
Thank you for the comment! It’s great to hear that you find the tutorials helpful. Please keep supporting us.
Regards,
Matthias
Thanks, this is helpful.
That’s great to hear! Thanks for the feedback!
Regards
Matthias