Grokbase Groups R r-help March 2011
FAQ
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.

Search Discussions

  • Rivercode at Mar 9, 2011 at 6:06 pm

    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.
  • Duncan Murdoch at Mar 10, 2011 at 12:06 am

    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 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.
  • Qinmao at Aug 24, 2011 at 8:14 am
    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.
  • . . at Aug 31, 2011 at 2:08 am
    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)
  • Jim Holtman at Aug 31, 2011 at 3:21 am
    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, ". ." 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 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.
  • Patrick Connolly at Aug 31, 2011 at 9:06 am
    . .


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

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



    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 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.
    --
    ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
    ___ Patrick Connolly
    {~._.~} Great minds discuss ideas
    _( Y )_ Average minds discuss events
    (:_~*~_:) Small minds discuss people
    (_)-(_) ..... Eleanor Roosevelt

    ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
  • Jim Lemon at Aug 31, 2011 at 10:07 am

    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
  • . . at Aug 31, 2011 at 2:25 pm
    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 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
  • David Winsemius at Aug 31, 2011 at 2:47 pm

    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.00004539993

    --
    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 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 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.
    David Winsemius, MD
    West Hartford, CT
  • Bert Gunter at Aug 31, 2011 at 3:05 pm

    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.00004539993

    --
    David
  • David Winsemius at Aug 31, 2011 at 3:26 pm

    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.00004539993

    --
    David
    David Winsemius, MD
    West Hartford, CT

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupr-help @
categoriesr
postedMar 9, '11 at 6:05p
activeAug 31, '11 at 3:26p
posts12
users9
websiter-project.org
irc#r

People

Translate

site design / logo © 2018 Grokbase