[R] R keeps crashing when executing 'rlogspline'
Uwe Ligges
ligges at statistik.uni-dortmund.de
Fri Jun 1 09:15:38 CEST 2007
Charles C. Berry wrote:
> On Thu, 31 May 2007, Jacques Wagnor wrote:
>
>> Dear List,
>>
>> I have a simple model as follows:
>>
>> x <- rnorm(500)
>> library(logspline)
>> fit <- logspline(x)
>> n <- 1000000
>> y <- replicate(n, sum(rlogspline(rpois(1,10), fit))) # last line
>>
>
> What you do not see in RGui is this:
>
>
> *** caught segfault ***
> address (nil), cause 'memory not mapped'
>
> Traceback:
> 1: .C("rpqlsd", as.double(c(fit$coef.pol, fit$coef.kts)),
> as.double(fit$knots), as.double(fit$bound), as.integer(0), qq =
> as.double(p), as.integer(length(fit$knots)), as.integer(length(p)),
> PACKAGE = "logspline")
> 2: qlogspline(pp, fit)
> [rest deleted]
>
> I think you are getting zero from rpois(1,10) with larger values of n.
>
> rlogspline does not check for n==0
>
> This results in calling qlogspline( numeric(0), fit ) and generates the
> segfault, I guess.
>
> So figure out what should happen when rpois(1,10) returns zero and avoid
> calling rlogspline in those cases.
And please do not forget to notify the package maintainer that there is
a bug in the package. The maintainer will probably be happy to know
about it. I am CCing to Charles Kooperberg.
Uwe Ligges
> If 'zero.value' is a suitable value, then this will work:
>
>> library(logspline)
>> x <- rnorm(500)
>> fit <- logspline(x)
>> res <- sapply(1:50, function(x) sum(rlogspline(x, fit)))
>> n <- 1000000
>> rp <- rpois(n,10)
>> y <- c( zero.value, res )[ rp+1 ] ## table lookup is faster!
>
> Chuck
>
>
>> The problem I keep getting is Rcrashes when doing the last line. It
>> seems to be fine if n is small, but not if n is 1000000. The message
>> I keep getting is:
>>
>> "R for Windows GUI front-end has encountered a problem and needs to
>> close. We are sorry for the inconvenience. If you were in the middle
>> of something, the information you were working on might be lost."
>>
>> Any insights would be appreciated,
>>
>> Jacques
>>
>> platform i386-pc-mingw32
>> arch i386
>> os mingw32
>> system i386, mingw32
>> status
>> major 2
>> minor 5.0
>> year 2007
>> month 04
>> day 23
>> svn rev 41293
>> language R
>> version.string R version 2.5.0 (2007-04-23)
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch 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.
>>
>
> Charles C. Berry (858) 534-2098
> Dept of Family/Preventive Medicine
> E mailto:cberry at tajo.ucsd.edu UC San Diego
> http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
More information about the R-help
mailing list