R Error “object not found” — Troubleshooting Guide (NYC)

The R error object 'x' not found appears when R cannot locate a variable, data frame, or object you referenced. This is one of the most common issues for students at NYU, Columbia, Baruch, and CUNY working on homework, exams, or projects.

For broader graduate statistics and software support, visit our main page: Statistics Tutoring NYC.

Why this error happens

  • The object was never created.
  • The code that creates the object was not run.
  • The object name is misspelled or capitalized differently.
  • You referenced a variable inside a data frame without using df$var.
  • You imported data incorrectly or into the wrong environment.

How to diagnose the problem

1. Check what objects exist

ls()

2. Confirm the object was created

score <- c(80, 85, 90)
mean(score)

3. Check data frame references

If your data is inside df, use:

mean(df$score)

4. Re-run your data import

df <- read.csv("data.csv")

How to fix it

  • Re-run the lines that create or load your objects.
  • Use ls() and str(df) to confirm exact names.
  • Avoid spaces or special characters in variable names.
  • Run your script from top to bottom to ensure objects exist in memory.

Need help?

If this error keeps appearing, the issue may be your workflow or environment setup. You can speak directly with the tutor who will help you fix your R code step-by-step.

Call or text: 646‑543‑0832
WhatsApp: 206‑384‑1336
Email: tutor@mytutornyc.com