[R] error with source(): invalid 'times' value

Gabor Grothendieck ggrothendieck at gmail.com
Mon Jan 24 18:52:11 CET 2011


On Mon, Jan 24, 2011 at 12:29 PM, Matthieu Stigler
<matthieu.stigler at gmail.com> wrote:
> Le 24. 01. 11 18:22, Gabor Grothendieck a écrit :
>>
>> On Mon, Jan 24, 2011 at 12:07 PM, Matthieu Stigler
>> <matthieu.stigler at gmail.com>  wrote:
>>>
>>> hi
>>>
>>> I am seeing a strange behavior I can't understand... doing:
>>>
>>>> source("/tmp/RFile.r",echo=TRUE)
>>>
>>> Error in rep.int(c(prompt.echo, continue.echo), c(leading, length(dep) -
>>>  :
>>>  invalid 'times' value
>>>>
>>>> traceback()
>>>
>>> 3: rep.int(c(prompt.echo, continue.echo), c(leading, length(dep) -
>>>       leading))
>>> 2: paste(rep.int(c(prompt.echo, continue.echo), c(leading, length(dep) -
>>>       leading)), dep, sep = "", collapse = "\n")
>>> 1: source("/tmp/RFile.r", echo = TRUE)>>
>>>
>>> But the file I am trying to source is very simple... see:
>>> $ more /tmp/RFile.r
>>> ###################################################
>>> ### chunk number 1:
>>> ###################################################
>>> #line 516 "VolStocksDec2010.Rnw"
>>> path<-"~/Dropbox/FAO/Papers/Volatility only"
>>> pathMarkov<-"~/Dropbox/FAO/Markov Model/"
>>> library(zoo)
>>>
>>> Any idea where it can come from? It works fine when echo=FALSE... I am
>>> using
>>> R 2.12, on Ubuntu Linux 10.4 (R from CRAN), full session info below.
>>> Should
>>> I rather send this to r-devel?
>>>
>> Does this work?
>>
>> source("/tmp/RFile.r", echo = TRUE, prompt.echo = NULL, continue.echo = "+
>> ")
>>
>>
> Thanks for your quick answer!
> Unfortunately, it does not change:
> source("/tmp/RFile.r", echo = TRUE, prompt.echo = NULL, continue.echo = "+
> ")
> Error in rep.int(c(prompt.echo, continue.echo), c(leading, length(dep) -  :
>  invalid 'times' value
>> traceback()
> 3: rep.int(c(prompt.echo, continue.echo), c(leading, length(dep) -
>       leading))
> 2: paste(rep.int(c(prompt.echo, continue.echo), c(leading, length(dep) -
>       leading)), dep, sep = "", collapse = "\n")
> 1: source("/tmp/RFile.r", echo = TRUE, prompt.echo = NULL, continue.echo =
> "+ ")
>
> note this is not a systematic problem, but can't say exactly when/why it
> works or not...

Check getOption("prompt.echo") and getOption("continue") and try
different values for the prompt.echo= and continue.echo= arguments of
source. I am able to get your times error by using source("myfile.R",
echo = TRUE, continue.echo = NULL)


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list