[R] error message documentation: "Error: no function to return from, jumping to top level"

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Thu Oct 2 15:24:12 CEST 2008

Duncan Murdoch wrote:
> tolga.i.uzuner at jpmorgan.com wrote:
>> Dear R Users,
>> Are error messages in R documented somewhere ? I am getting the
>> following error message and would like to track down what it means
>> and which specific routine triggers it:
>> Error: no function to return from, jumping to top level
>> Once I figure out which snippet of code triggers it, I can submit to
>> the list a working example in case I cannot get to the bottom of the
>> problem myself.
> There is no listing of error messages other than the source to R.  But
> you can often find where the error happened by using traceback(). 
> Search Google for "debugging R" for more hints.
The easiest way to get that message is to execute return() from the top

> return(1)
Error: no function to return from, jumping to top level

so a good guess is that you (Tolga) might be trying to return() from
source()d file. Or maybe source()ing something that was intended to be
inside a function body (extraneous '}' characters can do that).

   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907

More information about the R-help mailing list