From Kurt.Hornik at wu-wien.ac.at  Mon Apr  4 22:07:09 2005
From: Kurt.Hornik at wu-wien.ac.at (Kurt Hornik)
Date: Mon Apr  4 22:07:26 2005
Subject: [Rd] Error: cannot set length of non-vector
In-Reply-To: <16977.9902.875712.722704@mithrandir.hornik.net>
References: <200504021001.j32A1O1O003559@hypatia.math.ethz.ch>
	<20050403055024.GB16595@stat.umn.edu>
	<0oqv41d62slqdg1k4hpgmp1uplk2i9m6pm@4ax.com>
	<20050403172421.GA22788@stat.umn.edu>
	<16977.1546.138642.712005@mithrandir.hornik.net>
	<x2wtri7plb.fsf@turmalin.kubism.ku.dk>
	<16977.9902.875712.722704@mithrandir.hornik.net>
Message-ID: <16977.40557.280814.142897@mithrandir.hornik.net>

>>>>> Kurt Hornik writes:

>>>>> Peter Dalgaard writes:
>> Kurt Hornik <Kurt.Hornik@wu-wien.ac.at> writes:
>>> stack info at the C level to actually see where in the code the error
>>> triggers.  If I add debugging info prior to the error call, the error is
>>> gone.
>>> 
>>> Btw, if I comment *output* redirection in tools::checkVignettes(), the
>>> error is gone as well.
>>> 
>>> Note that this is *NOT* an error thrown by R CMD check.  The failure
>>> occurs when checkVignettes() is running the code (via source()) of the
>>> .R files created via Stangle(), and all the info we have about the error
>>> is being passed on.

>> Aha, so *that's* how to reproduce it. 

>> One thing that catches my eye is that 
>> tools::checkVignettes has

>> outConn <- textConnection("out", "w")
>> sink(outConn, type = "output")
>> sink(outConn, type = "message")
>> ....
>> for (f in rfiles) {
>> yy <- try(source(f))

>> and demo.R does extensive manipulation of an object called "out".

>> Perhaps it helps to do something like local(source(f, local=TRUE))? Or
>> maybe put local=TRUE in the textConnection() call.

> Or maybe
	
> 	textConnection("out", "w", local = TRUE)

> as done in similar places ...

[As you had already written.]

Or maybe use an anonymous tempfile.

Works for me, committed now.

-k


[Rd] Error: cannot set length of non-vector
Kurt Hornik