From hpages at fhcrc.org  Wed Sep 19 22:41:31 2012
From: hpages at fhcrc.org (=?ISO-8859-1?Q?Herv=E9_Pag=E8s?=)
Date: Wed, 19 Sep 2012 13:41:31 -0700
Subject: [Rd] example(smooth.spline) fails when function is NOT byte-compiled
Message-ID: <505A2DFB.8010000@fhcrc.org>

Hi,

example(smooth.spline) fails with the non byte-compiled version of the
smooth.spline function:

   > example(smooth.spline)

   smth.s> require(graphics)

   smth.s> attach(cars)

   smth.s> plot(speed, dist, main = "data(cars)  &  smoothing splines")

   [... more output deleted...]

   smth.s> lines(smooth.spline(speed, dist, df=10), lty=2, col = "red")
   Error in smooth.spline(speed, dist, df = 10) :
     smoothing parameter value too small

More precisely, here is what happens on a fresh R session (R-2.15.1
configured with --disable-byte-compiled-packages):

  ** Checking that smooth.spline() is not compiled:

   > smooth.spline
   [... output deleted...]
   <environment: namespace:stats>

  ** 1st call works:

   > res <- smooth.spline(c(4, 4, 7, 7, 8, 9), c(2, 10, 4, 22, 16, 10))


  ** 2nd call fails:

   > res <- smooth.spline(c(4, 4, 7, 7, 8, 9), c(2, 10, 4, 22, 16, 10))
   Error in smooth.spline(c(4, 4, 7, 7, 8, 9), c(2, 10, 4, 22, 16, 10)) :
     smoothing parameter value too small

  ** 3rd call (but now with the compiled version of the function) still
     fails:

   > library(compiler)

   > smooth.spline2 <- cmpfun(smooth.spline)

   > smooth.spline2
   [... output deleted...]
   <bytecode: 0x16813a0>
   <environment: namespace:stats>

   > res2 <- smooth.spline2(c(4, 4, 7, 7, 8, 9), c(2, 10, 4, 22, 16, 10))
   Error in smooth.spline2(c(4, 4, 7, 7, 8, 9), c(2, 10, 4, 22, 16, 10)) :
     smoothing parameter value too small

Thanks,
H.

My session info:

 > sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=C                 LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] compiler  stats     graphics  grDevices utils     datasets  methods
[8] base

loaded via a namespace (and not attached):
[1] tools_2.15.1


-- 
Herv? Pag?s

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



[Rd] example(smooth.spline) fails when function is NOT byte-compiled
=?ISO-8859-1?Q?Herv=E9_Pag=E8s?=