(TypeError:) Cannot read properties of null (reading: 'substr')

Hi there,
Does anyone know what this notification means? I cannot use autocompletion, no suggestions are showing. I can however type the column name (which is a bit tedious remembering...). It was working fine a few hours ago and stopped from one minute to the next, without any obvious action on my part. When googling, I found other TypeErrors, but none reported the same issues. Edit: I restarted RStudio and computer, it is working fine in R itself, and the message shows on several RStudio projects.
Any pointers much appreciated.

I can't reproduce that error message here, but I can say that your sample code looks suspicious. Apparently errors begins life as a matrix or data frame, but when you assign the calculation to errors$ratio you coerce it into a list. If you are trying to add a column to the errors matrix, what you want is errors <- cbind(errors, 1 - (errors[,3]/rowSums(errors))). You can then assign the name "ratio" to the extra column if so desired.

Hi there, thanks for taking the time to respond.

The above code may not have been the most illustrative example, it was the code I just happened to have used to test last before posting. You are correct, this particular object's life does start as some form of a matrix (as.dataframe.matrix()), but I use that function on a daily basis, and I could have taken a screenshot of any other project where the TypeError occurred that did not involve as.dataframe.matrix().

The weird thing is that the TypeError popped up out of the blue in a project I had been working on all day, and where I could access df columns normally just a minute before. For those projects it has since disappeared, i.e., the above example is actually the only case where I can now reproduce the TypeError. What is weird tho is that it seems to be an ordinary dataframe, and I can access the column names with $-tabcompletion for that object in R, and R/RStudio both print the column if I type the column name out - it's just that tab/autocompletion in RStudio seems compromised of some sort. It's very odd and unexpected behavior I have not seen before, and I use as.dataframe.matrix() a lot across many projects.

tl;dr. I'm happy to accept it is/was some random fluke caused by some background process or own unintentional action or whatnot, and I was curious why it occurred and wasn't resolved after a laptop and RStudio / session restart. Thanks again.

Screenshot of R.

I spoke too soon, it's back - but it happens intermittently. I'm sure it's got to do with some background process, I cannot make any sense of it yet.

This topic was automatically closed 21 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.