Why does it say an object I tried to create does not exist?

I tried to create two objects, index1 and index2, but they are showing up as not existing. Please see screenshot for all code. Thank you for your help.

HI @xjia7,
Welcome to the RStudio Community Forum.

The line numbers in your code pane are jumbled - something I have never seen before! I'm not sure how that has happened but it may mean that your code is not being run in the order that you expect giving you errors.

Try copying and pasting all the code into a new R script file, and check that the line numbers are in the correct order 1:26

Thanks. I think that is the problem. I tried copying and pasting the code into a new R script file, but the same thing happens. I think I'll make another post about it, in case anyone knows why this is happening.

Thank you.

Solved. In the latest version of RStudio, version RStudio-2022.07.1-554.exe (for Windows 10), if you go to Tools --> Global Options --> Code --> Display, there is an option to check "Relative line numbers". This was checked, giving the problem. I unchecked it and the problem has now disappeared.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.