Re: [R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

2011-08-31 Thread Patrick Connolly
. . 


-- .- -.-- -... .   ... --- -- .   
.-. . .--. .-. --- -.. ..- -.-. .- -... .-.. .   -.-. --- -.. .   
.-- --- ..- .-.. -..    . .-.. .--.   ..- ...   .- -. ... .-- . .-.   
-.-- --- ..- .-.   --.- ..- . ... - .. --- -.   ... - --- .--.

.- .--. --- .-.. --- --. .. . ...   ..-. --- .-.   -- -.--   
.-. ..- ... - -.--   -- --- .-. ... .   -.-. --- -.. .   ... - --- .--.




On Tue, 30-Aug-2011 at 11:08PM -0300, . . wrote:

| Hi all,
| 
| Why I am getting,
| 
| Error: evaluation nested too deeply: infinite recursion / 
options(expressions=)?
| 
| Thanks in advance!
| 
| func - Vectorize(function(x, a, sad, trunc=0, ...) {
|   result - function(x) {
| f1 - function(n) {
|   dcom - paste(d, deparse(substitute(sad)), sep=)
|  dots - c(as.name(n), list(...))
|  f - do.call(dcom, dots)
|   g - dpois(x,a*n)
|   f * g
| }
| integrate(f1, 0, Inf)$value
|   }
|   return(result(x) / (1 - result(trunc)))
| }, x)
| 
| func(1, 0.1, exp)
| 
| __
| R-help@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.

-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___Patrick Connolly   
 {~._.~}   Great minds discuss ideas
 _( Y )_ Average minds discuss events 
(:_~*~_:)  Small minds discuss people  
 (_)-(_)  . Eleanor Roosevelt
  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

__
R-help@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.


Re: [R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

2011-08-31 Thread Jim Lemon

On 08/31/2011 07:06 PM, Patrick Connolly wrote:

. .


-- .- -.-- -... .   ... --- -- .
.-. . .--. .-. --- -.. ..- -.-. .- -... .-.. .   -.-. --- -.. .
.-- --- ..- .-.. -..    . .-.. .--.   ..- ...   .- -. ... .-- . .-.
-.-- --- ..- .-.   --.- ..- . ... - .. --- -.   ... - --- .--.

.- .--. --- .-.. --- --. .. . ...   ..-. --- .-.   -- -.--
.-. ..- ... - -.--   -- --- .-. ... .   -.-. --- -.. .   ... - --- .--.


For those who can't read Morse code:

E E
MAYBE SOME REPRODUCABLE CODE WOULD HELP US ANSWER YOUR QUESTION STOP 
APOLOGIES FOR MY RUSTY MORSE CODE STOP


Jim

__
R-help@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.


Re: [R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

2011-08-31 Thread . .
I found that replacing dcom by dexp( that is what dcom will become
is this case) solve the problem. But I need some mechanics like this
provided by dcom, because I am planning to also use dgamma and many
others...

So, if some one have any idea it will be very appreciable.

Thanks in advance.

On Wed, Aug 31, 2011 at 7:07 AM, Jim Lemon j...@bitwrit.com.au wrote:
 On 08/31/2011 07:06 PM, Patrick Connolly wrote:

 . .


 -- .- -.-- -... .   ... --- -- .
 .-. . .--. .-. --- -.. ..- -.-. .- -... .-.. .   -.-. --- -.. .
 .-- --- ..- .-.. -..    . .-.. .--.   ..- ...   .- -. ... .-- . .-.
 -.-- --- ..- .-.   --.- ..- . ... - .. --- -.   ... - --- .--.

 .- .--. --- .-.. --- --. .. . ...   ..-. --- .-.   -- -.--
 .-. ..- ... - -.--   -- --- .-. ... .   -.-. --- -.. .   ... - --- .--.

 For those who can't read Morse code:

 E E
 MAYBE SOME REPRODUCABLE CODE WOULD HELP US ANSWER YOUR QUESTION STOP
 APOLOGIES FOR MY RUSTY MORSE CODE STOP

 Jim


__
R-help@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.


Re: [R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

2011-08-31 Thread David Winsemius


On Aug 31, 2011, at 10:25 AM, . . wrote:


I found that replacing dcom by dexp( that is what dcom will become
is this case) solve the problem. But I need some mechanics like this
provided by dcom, because I am planning to also use dgamma and many
others...


In R functions are things but they are not strings and cannot be  
executed by just asserting a character vector element. If you want to  
construct a 'call' from a acharacter, you can bridge that divide with  
do.call:


?do.call
fn - paste(d, gamma, sep=)
do.call(fn, list(1:10, shape=1) )
[1] 0.36787944117 0.13533528324 0.04978706837 0.01831563889  
0.00673794700
 [6] 0.00247875218 0.00091188197 0.00033546263 0.00012340980  
0.4539993


--
David



So, if some one have any idea it will be very appreciable.

Thanks in advance.

On Wed, Aug 31, 2011 at 7:07 AM, Jim Lemon j...@bitwrit.com.au wrote:

On 08/31/2011 07:06 PM, Patrick Connolly wrote:


. .


-- .- -.-- -... .   ... --- -- .
.-. . .--. .-. --- -.. ..- -.-. .- -... .-.. .   -.-. --- -.. .
.-- --- ..- .-.. -..    . .-.. .--.   ..- ...   .-  
-. ... .-- . .-.

-.-- --- ..- .-.   --.- ..- . ... - .. --- -.   ... - --- .--.

.- .--. --- .-.. --- --. .. . ...   ..-. --- .-.   -- -.--
.-. ..- ... - -.--   -- --- .-. ... .   -.-. --- -.. .   ... -  
--- .--.


For those who can't read Morse code:

E E
MAYBE SOME REPRODUCABLE CODE WOULD HELP US ANSWER YOUR QUESTION STOP
APOLOGIES FOR MY RUSTY MORSE CODE STOP

Jim



__
R-help@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.


David Winsemius, MD
West Hartford, CT

__
R-help@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.


Re: [R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

2011-08-31 Thread Bert Gunter

 In R functions are things but they are not strings and cannot be
 executed by just asserting a character vector element.

... But note that they can be executed by by asserting a list of
functions component (as well as by do.call below)

 x - c(rnorm, rt, rweibull) ## this is a list of functions
 x[[2]](10,df=5)
 [1] -1.03683857  1.20245119 -2.77762457 -0.02124206 -0.78748356  1.36294023
 [7]  0.50626709 -0.37386404  0.34371389 -1.28934128


Cheers,
Bert


 If you want to
 construct a 'call' from a a character, you can bridge that divide with
 do.call:

 ?do.call
 fn - paste(d, gamma, sep=)
 do.call(fn, list(1:10, shape=1) )
 [1] 0.36787944117 0.13533528324 0.04978706837 0.01831563889 0.00673794700
  [6] 0.00247875218 0.00091188197 0.00033546263 0.00012340980 0.4539993

 --
 David


__
R-help@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.


Re: [R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

2011-08-31 Thread David Winsemius


On Aug 31, 2011, at 11:05 AM, Bert Gunter wrote:



In R functions are things but they are not strings and cannot be
executed by just asserting a character vector element.


... But note that they can be executed by by asserting a list of
functions component (as well as by do.call below)


x - c(rnorm, rt, rweibull) ## this is a list of functions
x[[2]](10,df=5)
[1] -1.03683857  1.20245119 -2.77762457 -0.02124206 -0.78748356   
1.36294023

[7]  0.50626709 -0.37386404  0.34371389 -1.28934128


And the OP may want to also look at the examples in:

?match.arg
?match.fun

And ponder these results:

 funlist - list(dgamma, dnorm, dexp)
 dgamma %in% funlist
[1] FALSE

 class(funlist)
[1] list
 class(funlist[1])
[1] list
 class(funlist[[1]])
[1] function


 match.fun(dgamma)
function (x, shape, rate = 1, scale = 1/rate, log = FALSE)
.Internal(dgamma(x, shape, scale, log))
environment: namespace:stats



--
David.



Cheers,
Bert


If you want to
construct a 'call' from a a character, you can bridge that divide  
with

do.call:

?do.call
fn - paste(d, gamma, sep=)
do.call(fn, list(1:10, shape=1) )
[1] 0.36787944117 0.13533528324 0.04978706837 0.01831563889  
0.00673794700
 [6] 0.00247875218 0.00091188197 0.00033546263 0.00012340980  
0.4539993


--
David



David Winsemius, MD
West Hartford, CT

__
R-help@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.


[R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

2011-08-30 Thread . .
Hi all,

Why I am getting,

Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

Thanks in advance!

func - Vectorize(function(x, a, sad, trunc=0, ...) {
  result - function(x) {
f1 - function(n) {
  dcom - paste(d, deparse(substitute(sad)), sep=)
dots - c(as.name(n), list(...))
f - do.call(dcom, dots)
  g - dpois(x,a*n)
  f * g
}
integrate(f1, 0, Inf)$value
  }
  return(result(x) / (1 - result(trunc)))
}, x)

func(1, 0.1, exp)

__
R-help@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.


Re: [R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

2011-08-30 Thread Jim Holtman
get a 'traceback' at the point of the error to see how deep the stack is and 
what is being called.  Also look at the help page for 'options' to see how to 
get the browser when an error ocurs; this is under 'error' on the help page.  
also lookup debugging under R so that you can do this yourself.

the error indicates you have probably an infinite recursive call that you have 
to track down.

Sent from my iPad

On Aug 30, 2011, at 22:08, . . xkzi...@gmail.com wrote:

 Hi all,
 
 Why I am getting,
 
 Error: evaluation nested too deeply: infinite recursion / 
 options(expressions=)?
 
 Thanks in advance!
 
 func - Vectorize(function(x, a, sad, trunc=0, ...) {
  result - function(x) {
f1 - function(n) {
  dcom - paste(d, deparse(substitute(sad)), sep=)
dots - c(as.name(n), list(...))
f - do.call(dcom, dots)
  g - dpois(x,a*n)
  f * g
}
integrate(f1, 0, Inf)$value
  }
  return(result(x) / (1 - result(trunc)))
 }, x)
 
 func(1, 0.1, exp)
 
 __
 R-help@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.

__
R-help@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.


Re: [R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

2011-08-24 Thread qinmao
I think you have change options(expression = default_value)
you can input the command options()in Rconsole
And check the value of the expression.
and change the value to 100.
Hope you over this problem.

--
View this message in context: 
http://r.789695.n4.nabble.com/Error-evaluation-nested-too-deeply-infinite-recursion-options-expressions-tp3344168p3764732.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


[R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

2011-03-09 Thread rivercode
Hi,

I am processing tick data and my code has stopped working as I have
increased the size of data being processed.  Now I am receiving error for
basic tasks in RConsole:

 a = c(1:1000)
Error: evaluation nested too deeply: infinite recursion /
options(expressions=)?

My R code worked fine with 50 stocks and 500,000 rows per stock, but when I
increased this to 50 stocks and 5,000,000 rows per stock the code stopped
halfway through with the above error message (Error: Evaluation nested too
deeply.).

Now I am getting this error with simple commands in the Console, as per
above example.

Please advice where I should look to resolve this ?

I am using R 2.12.1 64Bit on Windows 7 with memory max at 8Gb.

Thanks,
Chris

--
View this message in context: 
http://r.789695.n4.nabble.com/Error-evaluation-nested-too-deeply-infinite-recursion-options-expressions-tp3344168p3344168.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

2011-03-09 Thread rivercode
For further info, I cannot check my memory usage or even use ls() :

 memory.limit
Error: evaluation nested too deeply: infinite recursion /
options(expressions=)?
 ?memory.limit
Error: evaluation nested too deeply: infinite recursion /
options(expressions=)?
 ls()
Error: evaluation nested too deeply: infinite recursion /
options(expressions=)?
 

Thanks,
Chris

--
View this message in context: 
http://r.789695.n4.nabble.com/Error-evaluation-nested-too-deeply-infinite-recursion-options-expressions-tp3344168p3344170.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

2011-03-09 Thread Duncan Murdoch

On 11-03-09 1:05 PM, rivercode wrote:

Hi,

I am processing tick data and my code has stopped working as I have
increased the size of data being processed.  Now I am receiving error for
basic tasks in RConsole:


a = c(1:1000)

Error: evaluation nested too deeply: infinite recursion /
options(expressions=)?


I imagine you've created your own function called c, and it tries to 
call the regular one, but ends up calling itself.


Duncan Murdoch



My R code worked fine with 50 stocks and 500,000 rows per stock, but when I
increased this to 50 stocks and 5,000,000 rows per stock the code stopped
halfway through with the above error message (Error: Evaluation nested too
deeply.).

Now I am getting this error with simple commands in the Console, as per
above example.

Please advice where I should look to resolve this ?

I am using R 2.12.1 64Bit on Windows 7 with memory max at 8Gb.

Thanks,
Chris

--
View this message in context: 
http://r.789695.n4.nabble.com/Error-evaluation-nested-too-deeply-infinite-recursion-options-expressions-tp3344168p3344168.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


__
R-help@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.


[R] Error: evaluation nested too deeply

2010-08-12 Thread abotaha

Hi guys, 
I have a code in R and it was work well but when I decrease the epsilon
value (indicated in the code) , then I am getting this error
Error: evaluation nested too deeply: infinite recursion /
options(expressions=)? 
any help please 


y = 6.8; 
w = 7.4;
z = 5.7;
muy = 7; 
muw = 7; 
muz = 6; 
sigmay = 0.8; 
sigmaz = 0.76; 
sigmaw = 0.3;
betayx = 0.03; 
betayz = 0.3; 
betayw = 0.67

s = c(3.2,0.8)

em = function(W,s) {
a= 1/2*(1/s[2]^2+betayx^2/sigmay^2); 
b=
(y-muy+betayx*s[1]-betayz*(z-muz)-betayw*(w-muw))*betayx/sigmay^2+s[1]/s[2]^2; 
c=(1/2)*((y-muy+betayx*s[1]-betayz*(z-muz)-betayw*(w-muw))*betayx/sigmay^2+s[1]/s[2]^2)^2/(1/s[2]^2+betayx^2/sigmay^2);
V = exp(-c+b^2/(4*a))/sqrt(pi/(1/(2*s[2]^2)+(1/2)*betayx^2/sigmay^2)); 
Omega = V*sqrt(pi/a);

A = 4*a^2*Omega*betayx^2/sigmay^2; 
B = 4*a^2; 
C = 2*a*b*Omega; 
d =
(2*a*b*Omega*betayx^2/sigmay^2)-(4*a^2*Omega*(y-muy-betayz*(z-muz)-betayw*(w-muw))*betayx/sigmay^2);
E = 2*a*Omega+b^2*Omega;
lambda = A*B; 
alpha = 2*A*C+d*B; 
delta = A*E+B^2+2*d*C; 
eta = C*B+d*E;
s[1]=(1/6)*(-36*delta*alpha*lambda+108*eta*lambda^2+8*alpha^3+12*sqrt(3)*sqrt(4*delta^3*lambda-delta^2*alpha^2-18*delta*alpha*lambda*eta+27*eta^2*lambda^2+4*eta*alpha^3)*lambda)^(1/3)/lambda+(2/3)*(-3*delta*lambda+alpha^2)/(lambda*(-36*delta*alpha*lambda+108*eta*lambda^2+8*alpha^3+12*sqrt(3)*sqrt(4*delta^3*lambda-delta^2*alpha^2-18*delta*alpha*lambda*eta+27*eta^2*lambda^2+4*eta*alpha^3)*lambda)^(1/3))+(1/3)*alpha/lambda;
s[2]=sqrt((B*s[1]^2-2*C*s[1]+E)/B);
 s
 }
epsilon =0.0005
iter = function(W, s) {
 s1 = em(W,s)
 for (i in 1:2) {
 if (abs(s[i]-s1[i])  epsilon) {
 s=s1
 iter(W,s)
 }
 else s1
 }
 s1
 }

iter(W,s)

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Error-evaluation-nested-too-deeply-tp2322701p2322701.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.