Quantcast

error with source(): invalid 'times' value

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

error with source(): invalid 'times' value

Matthieu Stigler
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?

Thanks a  lot

Matthieu


sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: i486-pc-linux-gnu (32-bit)

locale:
  [1] LC_CTYPE=fr_CH.utf8       LC_NUMERIC=C
  [3] LC_TIME=fr_CH.utf8        LC_COLLATE=fr_CH.utf8
  [5] LC_MONETARY=C             LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=fr_CH.utf8       LC_NAME=C
  [9] LC_ADDRESS=C              LC_TELEPHONE=C
[11] LC_MEASUREMENT=fr_CH.utf8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base

loaded via a namespace (and not attached):
[1] grid_2.12.1         lattice_0.19-17     Matrix_0.999375-45
[4] nnet_7.3-1          tsDyn_0.7-40        tseries_0.10-23
[7] tseriesChaos_0.1-11

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: error with source(): invalid 'times' value

Gabor Grothendieck
On Mon, Jan 24, 2011 at 12:07 PM, Matthieu Stigler
<[hidden email]> 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 = "+ ")


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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: error with source(): invalid 'times' value

Matthieu Stigler
Le 24. 01. 11 18:22, Gabor Grothendieck a écrit :

> On Mon, Jan 24, 2011 at 12:07 PM, Matthieu Stigler
> <[hidden email]>  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...

thanks

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: error with source(): invalid 'times' value

jholtman
In reply to this post by Matthieu Stigler
It sounds like you have some invalid expressions.  Dump out the values
of 'leading' and 'length(dep) - leading'.  Learn some simple debugging
techniques.  One is to set

options(error=utils::recover)

so that on the error you can use the browser to examine what the values are.

On Mon, Jan 24, 2011 at 12:07 PM, Matthieu Stigler
<[hidden email]> 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?
>
> Thanks a  lot
>
> Matthieu
>
>
> sessionInfo()
> R version 2.12.1 (2010-12-16)
> Platform: i486-pc-linux-gnu (32-bit)
>
> locale:
>  [1] LC_CTYPE=fr_CH.utf8       LC_NUMERIC=C
>  [3] LC_TIME=fr_CH.utf8        LC_COLLATE=fr_CH.utf8
>  [5] LC_MONETARY=C             LC_MESSAGES=en_US.UTF-8
>  [7] LC_PAPER=fr_CH.utf8       LC_NAME=C
>  [9] LC_ADDRESS=C              LC_TELEPHONE=C
> [11] LC_MEASUREMENT=fr_CH.utf8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices datasets  utils     methods   base
>
> loaded via a namespace (and not attached):
> [1] grid_2.12.1         lattice_0.19-17     Matrix_0.999375-45
> [4] nnet_7.3-1          tsDyn_0.7-40        tseries_0.10-23
> [7] tseriesChaos_0.1-11
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: error with source(): invalid 'times' value

Matthieu Stigler
ok, thanks Jim

The problem comes from length(dep)<leading, so we get negative number...
 > length(dep)
[1] 183

c(leading, length(dep) - leading)
[1]  516 -333

But 183 seems to be the right number:
$ wc -l /tmp/RFile.r
183 /tmp/RFile.r

So now need to understand what is this "dep", and why it has a bigger
length... tried to check source code (:-)) but could not get it... any
idea?

Thanks a lot

Matthieu


Le 24. 01. 11 18:29, jim holtman a écrit :

> It sounds like you have some invalid expressions.  Dump out the values
> of 'leading' and 'length(dep) - leading'.  Learn some simple debugging
> techniques.  One is to set
>
> options(error=utils::recover)
>
> so that on the error you can use the browser to examine what the values are.
>
> On Mon, Jan 24, 2011 at 12:07 PM, Matthieu Stigler
> <[hidden email]>  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?
>>
>> Thanks a  lot
>>
>> Matthieu
>>
>>
>> sessionInfo()
>> R version 2.12.1 (2010-12-16)
>> Platform: i486-pc-linux-gnu (32-bit)
>>
>> locale:
>>   [1] LC_CTYPE=fr_CH.utf8       LC_NUMERIC=C
>>   [3] LC_TIME=fr_CH.utf8        LC_COLLATE=fr_CH.utf8
>>   [5] LC_MONETARY=C             LC_MESSAGES=en_US.UTF-8
>>   [7] LC_PAPER=fr_CH.utf8       LC_NAME=C
>>   [9] LC_ADDRESS=C              LC_TELEPHONE=C
>> [11] LC_MEASUREMENT=fr_CH.utf8 LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] stats     graphics  grDevices datasets  utils     methods   base
>>
>> loaded via a namespace (and not attached):
>> [1] grid_2.12.1         lattice_0.19-17     Matrix_0.999375-45
>> [4] nnet_7.3-1          tsDyn_0.7-40        tseries_0.10-23
>> [7] tseriesChaos_0.1-11
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: error with source(): invalid 'times' value

Gabor Grothendieck
In reply to this post by Matthieu Stigler
On Mon, Jan 24, 2011 at 12:29 PM, Matthieu Stigler
<[hidden email]> wrote:

> Le 24. 01. 11 18:22, Gabor Grothendieck a écrit :
>>
>> On Mon, Jan 24, 2011 at 12:07 PM, Matthieu Stigler
>> <[hidden email]>  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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: error with source(): invalid 'times' value

jholtman
In reply to this post by Matthieu Stigler
Do 'str(dep)' to see what dep is and where it comes from.  If you have
the 'options' set as I suggested, you can do this examination when the
error occurs.

On Mon, Jan 24, 2011 at 12:41 PM, Matthieu Stigler
<[hidden email]> wrote:

> ok, thanks Jim
>
> The problem comes from length(dep)<leading, so we get negative number...
>> length(dep)
> [1] 183
>
> c(leading, length(dep) - leading)
> [1]  516 -333
>
> But 183 seems to be the right number:
> $ wc -l /tmp/RFile.r
> 183 /tmp/RFile.r
>
> So now need to understand what is this "dep", and why it has a bigger
> length... tried to check source code (:-)) but could not get it... any idea?
>
> Thanks a lot
>
> Matthieu
>
>
> Le 24. 01. 11 18:29, jim holtman a écrit :
>>
>> It sounds like you have some invalid expressions.  Dump out the values
>> of 'leading' and 'length(dep) - leading'.  Learn some simple debugging
>> techniques.  One is to set
>>
>> options(error=utils::recover)
>>
>> so that on the error you can use the browser to examine what the values
>> are.
>>
>> On Mon, Jan 24, 2011 at 12:07 PM, Matthieu Stigler
>> <[hidden email]>  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?
>>>
>>> Thanks a  lot
>>>
>>> Matthieu
>>>
>>>
>>> sessionInfo()
>>> R version 2.12.1 (2010-12-16)
>>> Platform: i486-pc-linux-gnu (32-bit)
>>>
>>> locale:
>>>  [1] LC_CTYPE=fr_CH.utf8       LC_NUMERIC=C
>>>  [3] LC_TIME=fr_CH.utf8        LC_COLLATE=fr_CH.utf8
>>>  [5] LC_MONETARY=C             LC_MESSAGES=en_US.UTF-8
>>>  [7] LC_PAPER=fr_CH.utf8       LC_NAME=C
>>>  [9] LC_ADDRESS=C              LC_TELEPHONE=C
>>> [11] LC_MEASUREMENT=fr_CH.utf8 LC_IDENTIFICATION=C
>>>
>>> attached base packages:
>>> [1] stats     graphics  grDevices datasets  utils     methods   base
>>>
>>> loaded via a namespace (and not attached):
>>> [1] grid_2.12.1         lattice_0.19-17     Matrix_0.999375-45
>>> [4] nnet_7.3-1          tsDyn_0.7-40        tseries_0.10-23
>>> [7] tseriesChaos_0.1-11
>>>
>>> ______________________________________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>
>



--
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: error with source(): invalid 'times' value

William Dunlap
Put a space after the # in the line
#line 516
to avoid the problem.  A similar problem also
appears in parse().

  > parse(text="#line 102\nlog(pi)\n")
  Error in `Encoding<-`(`*tmp*`, value = character(0)) :
    'value' must be of positive length
  > parse(text="# line 102\nlog(pi)\n")
  expression(log(pi))
  attr(,"srcfile")
  <text>
  attr(,"wholeSrcref")
  # line 102
  log(pi)

(I'm still using 2.12.0.)

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com  

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of jim holtman
> Sent: Monday, January 24, 2011 10:19 AM
> To: Matthieu Stigler
> Cc: [hidden email]
> Subject: Re: [R] error with source(): invalid 'times' value
>
> Do 'str(dep)' to see what dep is and where it comes from.  If you have
> the 'options' set as I suggested, you can do this examination when the
> error occurs.
>
> On Mon, Jan 24, 2011 at 12:41 PM, Matthieu Stigler
> <[hidden email]> wrote:
> > ok, thanks Jim
> >
> > The problem comes from length(dep)<leading, so we get
> negative number...
> >> length(dep)
> > [1] 183
> >
> > c(leading, length(dep) - leading)
> > [1]  516 -333
> >
> > But 183 seems to be the right number:
> > $ wc -l /tmp/RFile.r
> > 183 /tmp/RFile.r
> >
> > So now need to understand what is this "dep", and why it
> has a bigger
> > length... tried to check source code (:-)) but could not
> get it... any idea?
> >
> > Thanks a lot
> >
> > Matthieu
> >
> >
> > Le 24. 01. 11 18:29, jim holtman a écrit :
> >>
> >> It sounds like you have some invalid expressions.  Dump
> out the values
> >> of 'leading' and 'length(dep) - leading'.  Learn some
> simple debugging
> >> techniques.  One is to set
> >>
> >> options(error=utils::recover)
> >>
> >> so that on the error you can use the browser to examine
> what the values
> >> are.
> >>
> >> On Mon, Jan 24, 2011 at 12:07 PM, Matthieu Stigler
> >> <[hidden email]>  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?
> >>>
> >>> Thanks a  lot
> >>>
> >>> Matthieu
> >>>
> >>>
> >>> sessionInfo()
> >>> R version 2.12.1 (2010-12-16)
> >>> Platform: i486-pc-linux-gnu (32-bit)
> >>>
> >>> locale:
> >>>  [1] LC_CTYPE=fr_CH.utf8       LC_NUMERIC=C
> >>>  [3] LC_TIME=fr_CH.utf8        LC_COLLATE=fr_CH.utf8
> >>>  [5] LC_MONETARY=C             LC_MESSAGES=en_US.UTF-8
> >>>  [7] LC_PAPER=fr_CH.utf8       LC_NAME=C
> >>>  [9] LC_ADDRESS=C              LC_TELEPHONE=C
> >>> [11] LC_MEASUREMENT=fr_CH.utf8 LC_IDENTIFICATION=C
> >>>
> >>> attached base packages:
> >>> [1] stats     graphics  grDevices datasets  utils    
> methods   base
> >>>
> >>> loaded via a namespace (and not attached):
> >>> [1] grid_2.12.1         lattice_0.19-17     Matrix_0.999375-45
> >>> [4] nnet_7.3-1          tsDyn_0.7-40        tseries_0.10-23
> >>> [7] tseriesChaos_0.1-11
> >>>
> >>> ______________________________________________
> >>> [hidden email] mailing list
> >>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>> PLEASE do read the posting guide
> >>> http://www.R-project.org/posting-guide.html
> >>> and provide commented, minimal, self-contained, reproducible code.
> >>>
> >>
> >>
> >
> >
>
>
>
> --
> Jim Holtman
> Data Munger Guru
>
> What is the problem that you are trying to solve?
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: error with source(): invalid 'times' value

Duncan Murdoch-2
In reply to this post by Matthieu Stigler
On 11-01-24 12:07 PM, Matthieu Stigler 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?

There is no such version, but this looks like a bug that was fixed in
2.12.1.  Are you using 2.12.0?  (I might be wrong about the timing of
the fix; if you're using 2.12.1, try 2.12.1-patched.)

Duncan Murdoch

>
> Thanks a  lot
>
> Matthieu
>
>
> sessionInfo()
> R version 2.12.1 (2010-12-16)
> Platform: i486-pc-linux-gnu (32-bit)
>
> locale:
>    [1] LC_CTYPE=fr_CH.utf8       LC_NUMERIC=C
>    [3] LC_TIME=fr_CH.utf8        LC_COLLATE=fr_CH.utf8
>    [5] LC_MONETARY=C             LC_MESSAGES=en_US.UTF-8
>    [7] LC_PAPER=fr_CH.utf8       LC_NAME=C
>    [9] LC_ADDRESS=C              LC_TELEPHONE=C
> [11] LC_MEASUREMENT=fr_CH.utf8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices datasets  utils     methods   base
>
> loaded via a namespace (and not attached):
> [1] grid_2.12.1         lattice_0.19-17     Matrix_0.999375-45
> [4] nnet_7.3-1          tsDyn_0.7-40        tseries_0.10-23
> [7] tseriesChaos_0.1-11
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: error with source(): invalid 'times' value

Matthieu Stigler
In reply to this post by jholtman
Hi

Well this is the output of str(dep) on a small example:
str(dep)
  chr [1:8] "###################################################" ...
Browse[1]> dep
[1] "###################################################"
[2] "### chunk number 1:"
[3] "###################################################"
[4] "#line 516 \"VolStocksDec2010.Rnw\""
[5] "path<-\"~/Dropbox/FAO/Papers/Volatility only\""
[6] "pathMarkov<-\"~/Dropbox/FAO/Markov Model/\""
[7] "library(zoo)"
[8] ""

it seems quite accurate... I guess the problem comes form leading...
even if this smaller example, it is still the same number (516) as in
the test with bigger source doc...

Can you reproduce this on your machine? I can reproduce it on two Linux
buntu 10.4, R 2.12.1 ...

Thanks!!

Le 24. 01. 11 19:18, jim holtman a écrit :

> Do 'str(dep)' to see what dep is and where it comes from.  If you have
> the 'options' set as I suggested, you can do this examination when the
> error occurs.
>
> On Mon, Jan 24, 2011 at 12:41 PM, Matthieu Stigler
> <[hidden email]>  wrote:
>> ok, thanks Jim
>>
>> The problem comes from length(dep)<leading, so we get negative number...
>>> length(dep)
>> [1] 183
>>
>> c(leading, length(dep) - leading)
>> [1]  516 -333
>>
>> But 183 seems to be the right number:
>> $ wc -l /tmp/RFile.r
>> 183 /tmp/RFile.r
>>
>> So now need to understand what is this "dep", and why it has a bigger
>> length... tried to check source code (:-)) but could not get it... any idea?
>>
>> Thanks a lot
>>
>> Matthieu
>>
>>
>> Le 24. 01. 11 18:29, jim holtman a écrit :
>>> It sounds like you have some invalid expressions.  Dump out the values
>>> of 'leading' and 'length(dep) - leading'.  Learn some simple debugging
>>> techniques.  One is to set
>>>
>>> options(error=utils::recover)
>>>
>>> so that on the error you can use the browser to examine what the values
>>> are.
>>>
>>> On Mon, Jan 24, 2011 at 12:07 PM, Matthieu Stigler
>>> <[hidden email]>    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?
>>>>
>>>> Thanks a  lot
>>>>
>>>> Matthieu
>>>>
>>>>
>>>> sessionInfo()
>>>> R version 2.12.1 (2010-12-16)
>>>> Platform: i486-pc-linux-gnu (32-bit)
>>>>
>>>> locale:
>>>>   [1] LC_CTYPE=fr_CH.utf8       LC_NUMERIC=C
>>>>   [3] LC_TIME=fr_CH.utf8        LC_COLLATE=fr_CH.utf8
>>>>   [5] LC_MONETARY=C             LC_MESSAGES=en_US.UTF-8
>>>>   [7] LC_PAPER=fr_CH.utf8       LC_NAME=C
>>>>   [9] LC_ADDRESS=C              LC_TELEPHONE=C
>>>> [11] LC_MEASUREMENT=fr_CH.utf8 LC_IDENTIFICATION=C
>>>>
>>>> attached base packages:
>>>> [1] stats     graphics  grDevices datasets  utils     methods   base
>>>>
>>>> loaded via a namespace (and not attached):
>>>> [1] grid_2.12.1         lattice_0.19-17     Matrix_0.999375-45
>>>> [4] nnet_7.3-1          tsDyn_0.7-40        tseries_0.10-23
>>>> [7] tseriesChaos_0.1-11
>>>>
>>>> ______________________________________________
>>>> [hidden email] mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>
>>
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: error with source(): invalid 'times' value

Matthieu Stigler
In reply to this post by William Dunlap
indeed this makes the trick! quite strange... is this a known bug/issue?

thanks!

Matthieu

Le 24. 01. 11 19:48, William Dunlap a écrit :

> Put a space after the # in the line
> #line 516
> to avoid the problem.  A similar problem also
> appears in parse().
>
>    >  parse(text="#line 102\nlog(pi)\n")
>    Error in `Encoding<-`(`*tmp*`, value = character(0)) :
>      'value' must be of positive length
>    >  parse(text="# line 102\nlog(pi)\n")
>    expression(log(pi))
>    attr(,"srcfile")
>    <text>
>    attr(,"wholeSrcref")
>    # line 102
>    log(pi)
>
> (I'm still using 2.12.0.)
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
>> -----Original Message-----
>> From: [hidden email]
>> [mailto:[hidden email]] On Behalf Of jim holtman
>> Sent: Monday, January 24, 2011 10:19 AM
>> To: Matthieu Stigler
>> Cc: [hidden email]
>> Subject: Re: [R] error with source(): invalid 'times' value
>>
>> Do 'str(dep)' to see what dep is and where it comes from.  If you have
>> the 'options' set as I suggested, you can do this examination when the
>> error occurs.
>>
>> On Mon, Jan 24, 2011 at 12:41 PM, Matthieu Stigler
>> <[hidden email]>  wrote:
>>> ok, thanks Jim
>>>
>>> The problem comes from length(dep)<leading, so we get
>> negative number...
>>>> length(dep)
>>> [1] 183
>>>
>>> c(leading, length(dep) - leading)
>>> [1]  516 -333
>>>
>>> But 183 seems to be the right number:
>>> $ wc -l /tmp/RFile.r
>>> 183 /tmp/RFile.r
>>>
>>> So now need to understand what is this "dep", and why it
>> has a bigger
>>> length... tried to check source code (:-)) but could not
>> get it... any idea?
>>> Thanks a lot
>>>
>>> Matthieu
>>>
>>>
>>> Le 24. 01. 11 18:29, jim holtman a écrit :
>>>> It sounds like you have some invalid expressions.  Dump
>> out the values
>>>> of 'leading' and 'length(dep) - leading'.  Learn some
>> simple debugging
>>>> techniques.  One is to set
>>>>
>>>> options(error=utils::recover)
>>>>
>>>> so that on the error you can use the browser to examine
>> what the values
>>>> are.
>>>>
>>>> On Mon, Jan 24, 2011 at 12:07 PM, Matthieu Stigler
>>>> <[hidden email]>    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?
>>>>>
>>>>> Thanks a  lot
>>>>>
>>>>> Matthieu
>>>>>
>>>>>
>>>>> sessionInfo()
>>>>> R version 2.12.1 (2010-12-16)
>>>>> Platform: i486-pc-linux-gnu (32-bit)
>>>>>
>>>>> locale:
>>>>>   [1] LC_CTYPE=fr_CH.utf8       LC_NUMERIC=C
>>>>>   [3] LC_TIME=fr_CH.utf8        LC_COLLATE=fr_CH.utf8
>>>>>   [5] LC_MONETARY=C             LC_MESSAGES=en_US.UTF-8
>>>>>   [7] LC_PAPER=fr_CH.utf8       LC_NAME=C
>>>>>   [9] LC_ADDRESS=C              LC_TELEPHONE=C
>>>>> [11] LC_MEASUREMENT=fr_CH.utf8 LC_IDENTIFICATION=C
>>>>>
>>>>> attached base packages:
>>>>> [1] stats     graphics  grDevices datasets  utils
>> methods   base
>>>>> loaded via a namespace (and not attached):
>>>>> [1] grid_2.12.1         lattice_0.19-17     Matrix_0.999375-45
>>>>> [4] nnet_7.3-1          tsDyn_0.7-40        tseries_0.10-23
>>>>> [7] tseriesChaos_0.1-11
>>>>>
>>>>> ______________________________________________
>>>>> [hidden email] mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide
>>>>> http://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>
>>>>
>>>
>>
>>
>> --
>> Jim Holtman
>> Data Munger Guru
>>
>> What is the problem that you are trying to solve?
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: error with source(): invalid 'times' value

Matthieu Stigler
In reply to this post by Duncan Murdoch-2
Le 24. 01. 11 20:43, Duncan Murdoch a écrit :

> On 11-01-24 12:07 PM, Matthieu Stigler 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?
>
> There is no such version, but this looks like a bug that was fixed in
> 2.12.1.  Are you using 2.12.0?  (I might be wrong about the timing of
> the fix; if you're using 2.12.1, try 2.12.1-patched.)
Indeed 2.12.1, sorry for imprecision! I will give a try to
2.12.1-patched, although I am not so sure how I can install it (should I
compile) on linux...

thanks!!

>
> Duncan Murdoch
>
>>
>> Thanks a  lot
>>
>> Matthieu
>>
>>
>> sessionInfo()
>> R version 2.12.1 (2010-12-16)
>> Platform: i486-pc-linux-gnu (32-bit)
>>
>> locale:
>>    [1] LC_CTYPE=fr_CH.utf8       LC_NUMERIC=C
>>    [3] LC_TIME=fr_CH.utf8        LC_COLLATE=fr_CH.utf8
>>    [5] LC_MONETARY=C             LC_MESSAGES=en_US.UTF-8
>>    [7] LC_PAPER=fr_CH.utf8       LC_NAME=C
>>    [9] LC_ADDRESS=C              LC_TELEPHONE=C
>> [11] LC_MEASUREMENT=fr_CH.utf8 LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] stats     graphics  grDevices datasets  utils     methods   base
>>
>> loaded via a namespace (and not attached):
>> [1] grid_2.12.1         lattice_0.19-17     Matrix_0.999375-45
>> [4] nnet_7.3-1          tsDyn_0.7-40        tseries_0.10-23
>> [7] tseriesChaos_0.1-11
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: error with source(): invalid 'times' value

William Dunlap
In reply to this post by Matthieu Stigler
> -----Original Message-----
> From: mat [mailto:[hidden email]]
> Sent: Monday, January 24, 2011 2:09 PM
> To: William Dunlap
> Cc: jim holtman; [hidden email]; [hidden email]
> Subject: Re: [R] error with source(): invalid 'times' value
>
> indeed this makes the trick! quite strange... is this a known
> bug/issue?

It is known now.  The problem arises while
printing the output of parse because the srcref
attribute contains the numbers from those
  #line <number>
entries and the printing routine gets confused
if the numbers are out of the range 1 through
the number of lines of text.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com  

>
> thanks!
>
> Matthieu
>
> Le 24. 01. 11 19:48, William Dunlap a écrit :
> > Put a space after the # in the line
> > #line 516
> > to avoid the problem.  A similar problem also
> > appears in parse().
> >
> >    >  parse(text="#line 102\nlog(pi)\n")
> >    Error in `Encoding<-`(`*tmp*`, value = character(0)) :
> >      'value' must be of positive length
> >    >  parse(text="# line 102\nlog(pi)\n")
> >    expression(log(pi))
> >    attr(,"srcfile")
> >    <text>
> >    attr(,"wholeSrcref")
> >    # line 102
> >    log(pi)
> >
> > (I'm still using 2.12.0.)
> >
> > Bill Dunlap
> > Spotfire, TIBCO Software
> > wdunlap tibco.com
> >
> >> -----Original Message-----
> >> From: [hidden email]
> >> [mailto:[hidden email]] On Behalf Of jim holtman
> >> Sent: Monday, January 24, 2011 10:19 AM
> >> To: Matthieu Stigler
> >> Cc: [hidden email]
> >> Subject: Re: [R] error with source(): invalid 'times' value
> >>
> >> Do 'str(dep)' to see what dep is and where it comes from.  
> If you have
> >> the 'options' set as I suggested, you can do this
> examination when the
> >> error occurs.
> >>
> >> On Mon, Jan 24, 2011 at 12:41 PM, Matthieu Stigler
> >> <[hidden email]>  wrote:
> >>> ok, thanks Jim
> >>>
> >>> The problem comes from length(dep)<leading, so we get
> >> negative number...
> >>>> length(dep)
> >>> [1] 183
> >>>
> >>> c(leading, length(dep) - leading)
> >>> [1]  516 -333
> >>>
> >>> But 183 seems to be the right number:
> >>> $ wc -l /tmp/RFile.r
> >>> 183 /tmp/RFile.r
> >>>
> >>> So now need to understand what is this "dep", and why it
> >> has a bigger
> >>> length... tried to check source code (:-)) but could not
> >> get it... any idea?
> >>> Thanks a lot
> >>>
> >>> Matthieu
> >>>
> >>>
> >>> Le 24. 01. 11 18:29, jim holtman a écrit :
> >>>> It sounds like you have some invalid expressions.  Dump
> >> out the values
> >>>> of 'leading' and 'length(dep) - leading'.  Learn some
> >> simple debugging
> >>>> techniques.  One is to set
> >>>>
> >>>> options(error=utils::recover)
> >>>>
> >>>> so that on the error you can use the browser to examine
> >> what the values
> >>>> are.
> >>>>
> >>>> On Mon, Jan 24, 2011 at 12:07 PM, Matthieu Stigler
> >>>> <[hidden email]>    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?
> >>>>>
> >>>>> Thanks a  lot
> >>>>>
> >>>>> Matthieu
> >>>>>
> >>>>>
> >>>>> sessionInfo()
> >>>>> R version 2.12.1 (2010-12-16)
> >>>>> Platform: i486-pc-linux-gnu (32-bit)
> >>>>>
> >>>>> locale:
> >>>>>   [1] LC_CTYPE=fr_CH.utf8       LC_NUMERIC=C
> >>>>>   [3] LC_TIME=fr_CH.utf8        LC_COLLATE=fr_CH.utf8
> >>>>>   [5] LC_MONETARY=C             LC_MESSAGES=en_US.UTF-8
> >>>>>   [7] LC_PAPER=fr_CH.utf8       LC_NAME=C
> >>>>>   [9] LC_ADDRESS=C              LC_TELEPHONE=C
> >>>>> [11] LC_MEASUREMENT=fr_CH.utf8 LC_IDENTIFICATION=C
> >>>>>
> >>>>> attached base packages:
> >>>>> [1] stats     graphics  grDevices datasets  utils
> >> methods   base
> >>>>> loaded via a namespace (and not attached):
> >>>>> [1] grid_2.12.1         lattice_0.19-17     Matrix_0.999375-45
> >>>>> [4] nnet_7.3-1          tsDyn_0.7-40        tseries_0.10-23
> >>>>> [7] tseriesChaos_0.1-11
> >>>>>
> >>>>> ______________________________________________
> >>>>> [hidden email] mailing list
> >>>>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>>>> PLEASE do read the posting guide
> >>>>> http://www.R-project.org/posting-guide.html
> >>>>> and provide commented, minimal, self-contained,
> reproducible code.
> >>>>>
> >>>>
> >>>
> >>
> >>
> >> --
> >> Jim Holtman
> >> Data Munger Guru
> >>
> >> What is the problem that you are trying to solve?
> >>
> >> ______________________________________________
> >> [hidden email] mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: error with source(): invalid 'times' value

Duncan Murdoch-2
In reply to this post by Matthieu Stigler
On 11-01-24 5:09 PM, mat wrote:

> Le 24. 01. 11 20:43, Duncan Murdoch a écrit :
>> On 11-01-24 12:07 PM, Matthieu Stigler 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?
>>
>> There is no such version, but this looks like a bug that was fixed in
>> 2.12.1.  Are you using 2.12.0?  (I might be wrong about the timing of
>> the fix; if you're using 2.12.1, try 2.12.1-patched.)
> Indeed 2.12.1, sorry for imprecision! I will give a try to
> 2.12.1-patched, although I am not so sure how I can install it (should I
> compile) on linux...

Bill Dunlap has already confirmed that this is not what was fixed (or
what was fixed never made it into the sources).  I'll get to it, but not
for a couple of weeks.

Duncan Murdoch

>
> thanks!!
>>
>> Duncan Murdoch
>>
>>>
>>> Thanks a  lot
>>>
>>> Matthieu
>>>
>>>
>>> sessionInfo()
>>> R version 2.12.1 (2010-12-16)
>>> Platform: i486-pc-linux-gnu (32-bit)
>>>
>>> locale:
>>>     [1] LC_CTYPE=fr_CH.utf8       LC_NUMERIC=C
>>>     [3] LC_TIME=fr_CH.utf8        LC_COLLATE=fr_CH.utf8
>>>     [5] LC_MONETARY=C             LC_MESSAGES=en_US.UTF-8
>>>     [7] LC_PAPER=fr_CH.utf8       LC_NAME=C
>>>     [9] LC_ADDRESS=C              LC_TELEPHONE=C
>>> [11] LC_MEASUREMENT=fr_CH.utf8 LC_IDENTIFICATION=C
>>>
>>> attached base packages:
>>> [1] stats     graphics  grDevices datasets  utils     methods   base
>>>
>>> loaded via a namespace (and not attached):
>>> [1] grid_2.12.1         lattice_0.19-17     Matrix_0.999375-45
>>> [4] nnet_7.3-1          tsDyn_0.7-40        tseries_0.10-23
>>> [7] tseriesChaos_0.1-11
>>>
>>> ______________________________________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: error with source(): invalid 'times' value

Duncan Murdoch-2
This is somewhat fixed now in R-patched and R-devel, as of revision
54235.  It won't die with an error, but it still might not be perfect.

The problem is that the line

#line 516 "VolStocksDec2010.Rnw"

is taken as a statement by you that the next few lines are copied from
line 516 and following in the "VolStocksDec2010.Rnw" file.  If that's
not true (e.g. that file doesn't exist any more, or has changed) you
might not get what you want in the echoed code.

I may still make some more changes:  either stop Stangle from including
those lines, or add an option to source() to get it to ignore them.  The
trouble is that those lines are often useful:  they're how errors are
reported relative to the original Rnw file, rather than the intermediate
tangled file.  I've added a note to ?source to point out that there
might be a problem; I may just stop with that.

Duncan Murdoch

On 24/01/2011 7:04 PM, Duncan Murdoch wrote:

> On 11-01-24 5:09 PM, mat wrote:
>> Le 24. 01. 11 20:43, Duncan Murdoch a écrit :
>>> On 11-01-24 12:07 PM, Matthieu Stigler 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?
>>>
>>> There is no such version, but this looks like a bug that was fixed in
>>> 2.12.1.  Are you using 2.12.0?  (I might be wrong about the timing of
>>> the fix; if you're using 2.12.1, try 2.12.1-patched.)
>> Indeed 2.12.1, sorry for imprecision! I will give a try to
>> 2.12.1-patched, although I am not so sure how I can install it (should I
>> compile) on linux...
>
> Bill Dunlap has already confirmed that this is not what was fixed (or
> what was fixed never made it into the sources).  I'll get to it, but not
> for a couple of weeks.
>
> Duncan Murdoch
>
>>
>> thanks!!
>>>
>>> Duncan Murdoch
>>>
>>>>
>>>> Thanks a  lot
>>>>
>>>> Matthieu
>>>>
>>>>
>>>> sessionInfo()
>>>> R version 2.12.1 (2010-12-16)
>>>> Platform: i486-pc-linux-gnu (32-bit)
>>>>
>>>> locale:
>>>>      [1] LC_CTYPE=fr_CH.utf8       LC_NUMERIC=C
>>>>      [3] LC_TIME=fr_CH.utf8        LC_COLLATE=fr_CH.utf8
>>>>      [5] LC_MONETARY=C             LC_MESSAGES=en_US.UTF-8
>>>>      [7] LC_PAPER=fr_CH.utf8       LC_NAME=C
>>>>      [9] LC_ADDRESS=C              LC_TELEPHONE=C
>>>> [11] LC_MEASUREMENT=fr_CH.utf8 LC_IDENTIFICATION=C
>>>>
>>>> attached base packages:
>>>> [1] stats     graphics  grDevices datasets  utils     methods   base
>>>>
>>>> loaded via a namespace (and not attached):
>>>> [1] grid_2.12.1         lattice_0.19-17     Matrix_0.999375-45
>>>> [4] nnet_7.3-1          tsDyn_0.7-40        tseries_0.10-23
>>>> [7] tseriesChaos_0.1-11
>>>>
>>>> ______________________________________________
>>>> [hidden email] mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Loading...