[R] R CMD check detects parse error, but in which file?

Uwe Ligges ligges at statistik.tu-dortmund.de
Wed Mar 4 13:35:54 CET 2009

Matthieu Stigler wrote:
> Jim Lemon a écrit :
>> Matthieu Stigler wrote:
>>> Hello
>>> I looked on the archives but did not find answer for that...
>>> Running R CMD check for a package, i get an error:
>>> Error in parse(n = -1, file = file) : unexpected symbol at
>>> 3341: }
>>> But how can I find which file is guilty? What is this 3342 referring to?
>>> Finally the solution I found is to source() every file until I find 
>>> the file where the problem is... Is there some better way to do it? 
>>> With a debuger? thanks a lot!
>> Hi Matthieu,
>> My understanding (and I may get clipped up alongside the head if I'm 
>> wrong) is that R concatenates all the source code into one big file 
>> hen checking and the number is the line number in that file. The error 
>> message may mean that you have an extra right parenthesis in that line 
>> (or very near to).
> yes I think you are right, as I received similar answer from Uwe Liggs:
> Given I remember correctly without looking into the details:
> It is the line number in the concatenated file (of all your .R files, by 
> default sorted in a C locale).
> Uwe added, there is no method known to him to determine in which file 

NO, I said something different (maybe my English is too bad so you 

I said I'd use your method of source()ing all files separately (i.e. 
using a for loop) and looking which file fails (with curretn versions of 
R) and I said that R-devel (i.e. the current development version of R) 
tells you in which file the error is.
So please try R-devel to be R-2.9.0 in roughly 1-2 months.

Uwe Ligges

> the problem is, and he recommended to post to r-devel. I'll do in a 
> while if there is no answer in r-help, to avoid cross-posting.
> Thanks to both of you!
> Matthieu
>> Jim

More information about the R-help mailing list