[R] error "variable names are limited to 256 bytes" when sourcing code

Duncan Murdoch murdoch.duncan at gmail.com
Wed May 26 22:22:55 CEST 2010

Brian Frizzelle wrote:
> I've written a function that takes some input data output from a 
> simulation model and creates some graphs. It's not very complicated 
> code, and it works perfectly fine if I just run the code as is.
> But I have converted it into a function so we call it externally, and 
> when I try to source the code to test the function, I get the error 
> message "variable names are limited to 256 bytes". I've tried searching 
> online for a solution to this, but everything I have come across deals 
> with this error in relation to input data, not a function.
> The code is 389 lines long, so I'd rather not paste it here and clog up 
> inboxes. If you have an idea as to why this is happening and would like 
> to see the code, please email me and I will send it to you.

Current versions of R will tell you which line contained the error.  
Can't you find and post just that one line?  If you aren't seeing an 
error report, you could divide and conquer:  edit blocks out of your 
file until you can figure out which lines matter.

My guess would be something involving backticks (i.e. things like `x`); 
R will see the first one, and collect characters until the next one as a 
single identifier.

Duncan Murdoch

More information about the R-help mailing list