"undefined" appears when writing code

Hello everyone,

I am new to R and Rstudio.
When I write a code in the script window and if push Enter or Tab keys, a word "undefined" appears...
Does anyone know how to stop this "undefined" shows up?

If you're typing a word that's not the name of an object in your environment without quotation marks around it, R will tell you that it's not found, but usually the error message will be Error: object '<THE WORD YOU TYPED IN>' not found.

Could you be more specific about what exactly is happening when you say "appears"? Is it returned in the console, or is it some sort of hover box?

Does what you're doing work for you in R, but not in RStudio? (see FAQ below for disambiguation)

1 Like

Thank you for your reply.

I am using Rstudio. I checked if the same problem exists in R. When I use R, the problem did not occur.

Specifically, when I am writing the code in the Source panel (not Console) and using brackets {}.
for example:

for(i in 1:2) {

then if I break the line (Enter) or insert tab, it is like this:

for(i in 1:2) {
undefined

So the word undefined appears in your source panel?

That is very strange. I'm not able to reproduce this, but could you share your operating system and RStudio versions so an IDE developer can look into it?

Also, I'm going to move this to the RStudio IDE category, since it sounds like it's an IDE-specific problem.

My operating system is Windows 10 64bit.
My Rstudio is Version 1.1.463; Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/538.1 (KHTML, like Gecko) rstudio Safari/538.1 Qt/5.4.1

Thanks and weird issue. Could you provide a screenshot of this error?

A diagnostics report may also be helpful.

You can also try resetting RStudio's state: https://support.rstudio.com/hc/en-us/articles/200534577-Resetting-RStudio-Desktop-s-State

Thank you for advice.
If I start a new project, the problem does not occur.

So I reset the project setting, namely changing the name of the directory of .Rproj.user, but it did not work.

Then, when I moved all files including .Rproj, to different new folder, the problem solved.

Thank you very much again for your help. Below I am attaching the screenshot in the case.

1 Like