I get this:
Error in paste0(width, on, k) : object 'x' not found
I am completely confused why he complains about the "x" on this particular line!
on is a character, width and k are numbers. x exists (this is a parameter of this function). This line and the previous ones look like this:
print(index(x)) stopifnot(length(index(x))>=1)
But even stranger, when I added a commented line that he complains about:
Error in str(on) : object 'x' not found
What caused this question, there were several call levels, I added this line:
rm(x)
( rm(list=c("x")) gives the same behavior.)
So, I was expecting the error "x not found". But not on this line (even in this function)!
Background : I found an error in which the code relied on a global variable named x , which should be passed as a parameter. He worked in unit test, failed in real code, because the variable in question was not called "x" in real code !! So, I decided to explicitly delete each variable when I finished it, to find out if I have more errors of this type.
(If the above code snippets are not enough for someone to go “Yeah Darren, you still don't understand how R ... works,” I will try to create a minimal example to reproduce the problem.)
Darren cook
source share