R Error: Object X not Found (2 Examples)


This tutorial explains how to reproduce and fix the error message “object X not found” in R.

The article contains the following topics:

Let’s start right away…


Example 1: Replicating the Error: object ‘x’ not found

Example 1 shows how to reproduce the error message “object X not found” in R.

Let’s assume that we want to return a data object called x to the RStudio console:

x                # Trying to print data object to console
# Error: object 'x' not found

As you can see based on the previous output of the RStudio console, the previous R code leads to the error message “”object ‘x’ not found”.

The reason for this is that the data object x does not exist.

Let’s fix this error…


Example 2: Fixing the Error: object ‘x’ not found

The following R programming code explains how to solve problems with the error “object X not found”.

For this, we have to define the object we want to use first:

x <- 1:10        # Assigning values to data object

Now, we can print this data object to the RStudio console:

x                # Printing data object to console
#  [1]  1  2  3  4  5  6  7  8  9 10

Looks good!


Video, Further Resources & Summary

In case you need further explanations on the R code of this page, you may have a look at the following video of my YouTube channel. I show the examples of this article in the video:



Furthermore, I can recommend to read some of the related tutorials of my website:


At this point you should know how to handle the error “object X not found” in the R programming language. Don’t hesitate to let me know in the comments section, in case you have any further comments or questions. Furthermore, don’t forget to subscribe to my email newsletter in order to receive updates on new tutorials.


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.

8 Comments. Leave new

  • helo i’m calculating kideraFactor in R so i install peptide package but still i’m facing this Error: object ‘kideraFactors’ not found

  • Hi Joachim,

    I have pasted my code below along with the error message i face when I run a Rscript check in the terminal. This code seemes to work fine in Rstudio and the plot comes up but in the terminal it doesnt seem to recognise my dataset “score”, would you be able to help me understand where im going wrong ?

    Thank you in advance,

    pdf(“C:/Users/Arbaaz/Desktop/practical/group_b_41/group_b_41/visualization.pdf”, width = 10, height = 10)
    ggplot(score, aes(Goals, MotM)) + geom_point(shape = 21, size = 1, colour = “red”)

    Error in ggplot(score, aes(Goals, MotM)) : object ‘score’ not found
    Execution halted

    • Hey Arbaaz,

      Thanks for the comprehensive description of your problem.

      It looks like you are not creating a data object when reading the data set from your CSV file.

      Does it work when you replace the second line of your code with the following syntax?

      score <- read.csv("C:/Users/Arbaaz/Desktop/practical/group_b_41/group_b_41/score.csv")


  • useless post haha

  • for me, r brings the error, object X not found for the first variable that i wish to select.

    here is the code:
    sympts <- select(Symptom_ID, Total_Berries, `BerriesSymptom`, No.LesionsBerry, AverageCoverageBerry)

    the out put:
    Error in select(Symptom_ID, Total_RBD_Berries, `Berries Wiz d Symptom`, :
    object 'Symptom_ID' not found

    hoping for your reply


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.