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
<matthieu.stigler at gmail.com> 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 <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?
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
______________________________________________ R-help at r-project.org 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?