Re: [R] Error: C stack usage is too close to the limit

From: jim holtman <jholtman_at_gmail.com>
Date: Sat, 26 Jan 2008 17:51:42 -0500

Your function has 4 parameters and you are only calling with two. The first statement:

caldist <- function(cage=Cage, error=Error, sdev=Sdev, times=Times, By=By)  {
  theta <- seq(min(calcurve[,1]), max(calcurve[,1]), by=By);

use "By" which is not defined.

On Jan 26, 2008 4:29 PM, Maarten Blaauw <maarten.blaauw_at_geo.uu.se> wrote:
> Lately R has been behaving strange on my Linux (Ubuntu 7.10) machine,
> with occasional segfaults. Today something else and reproducible
> happened:
>
> If I type the code below (meant for calibrating data), I get the error
> message that "the C stack usage is too close to the limit".
>
> calcurve <- cbind(1:2e4, 1:2e4, 1:2e3); #dummy curve, real one is more complex
>
> caldist <- function(cage=Cage, error=Error, sdev=Sdev, times=Times, By=By)
> {
> theta <- seq(min(calcurve[,1]), max(calcurve[,1]), by=By);
>
> interpolate <- function(th, col)
> {
> if(th==calcurve[1,1]) {calcurve[1,col]}else
> if(th==calcurve[nrow(calcurve),1]) {calcurve[nrow(calcurve),col]}else
> {
> k <- min(which(calcurve[,1] > th));
> slope <-
> (calcurve[k-1,col]-calcurve[k,col])/(calcurve[k-1,1]-calcurve[k,1]);
> calcurve[k-1,col] + slope*(th-calcurve[k-1,1]);
> }
> }
>
> mu <- c();
> cerror <- c();
> for(i in 1:length(theta))
> {
> mu[i] <- interpolate(theta[i],2);
> cerror[i] <- interpolate(theta[i],3);
> }
>
> caldist <- dnorm(mu, cage, (error^2+cerror^2)^.5);
> cbind(theta, caldist/sum(caldist));
> }
>
> caldist(1e3,1e2);
>
> Unfortunately I am no huge computer wizard. Has anyone got any idea
> why this happens? Is it reproducible on other machines? How can I
> solve this problem?
>
> My R:
> R version 2.6.1 (2007-11-26)
> i486-pc-linux-gnu
>
> locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> loaded via a namespace (and not attached):
> [1] rcompgen_0.1-17
>
> Cstack_info()
> size current direction eval_depth
> 8388608 2404 1 2
>
> Many thanks,
>
> Maarten Blaauw
>
> --
> Dr. Maarten Blaauw
> School of Geography, Archaeology & Palaeoecology
> Queen's University Belfast, U.K.
> On leave from Department of Earth Sciences
> Uppsala University, Sweden
> maarten.blaauw_at_geo.uu.se
>
> ______________________________________________
> 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
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
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.
Received on Sat 26 Jan 2008 - 22:55:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 27 Jan 2008 - 00:30:09 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive