Re: [Rd] Stack smashing in RODBC

2010-01-26 Thread Dirk Eddelbuettel

On 26 January 2010 at 01:23, "Tom \"spot\" Callaway" wrote:
| On 01/25/2010 09:14 PM, Dirk Eddelbuettel wrote:
| > I cannot replicate this on Debian. The error gets trapped just fine. This 
may
| > be particular to your builds or setup. I don;t see an R error (but of course
| > do not speak for R Core). Here is a short version, it is the same in normal
| > interactive mode.
| 
| I don't think Debian builds with stack protection in glibc, whereas
| Fedora does (and I think Ubuntu Hardy and onward also do).

As I get the exact same result on Ubuntu, I continue to suspect that the
issue with Fedora.

e...@joe:~$ echo 'library(RODBC); channel <- odbcConnect("foo", uid="bar")' | R 
--slave
Warning messages:
1: In odbcDriverConnect("DSN=foo;UID=bar") :
  [RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver Manager]Data 
source name not found, and no default driver specified
2: In odbcDriverConnect("DSN=foo;UID=bar") : ODBC connection failed
e...@joe:~$ COLUMNS=78 dpkg -l r-base-core r-cran-rodbc | tail -2
ii  r-base-core2.10.1-2karmic GNU R core of statistical computation and gr
ii  r-cran-rodbc   1.3-1-1karmic0 GNU R package for ODBC database access
e...@joe:~$

FWIW, on Debian and Ubuntu, unixodbc_2.2.11 is used.

Dirk

-- 
Three out of two people have difficulties with fractions.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] tm installation (PR#14193)

2010-01-26 Thread ctelmo
Full_Name: Cesar Telmo Costa
Version: R version 2.9.2 (2009-08-24)
OS: Ubuntu kermic
Submission from: (NULL) (85.241.174.237)


AFTER install.packages("tm"):

downloaded 317 Kb

* Installing *source* package ‘tm’ ...
** libs
gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c lazyTmMap.c -o
lazyTmMap.o
gcc -std=gnu99 -shared -o tm.so lazyTmMap.o -L/usr/lib/R/lib -lR
** R
** data
** inst
** preparing package for lazy loading
Error in setOldClass(c("VCorpus", "Corpus", "list")) :
  inconsistent old-style class information for "list"; the class is defined but
does not extend "oldClass"
Error : unable to load R code in package 'tm'
ERROR: lazy loading failed for package ‘tm’
* Removing ‘/home/ctelmo/R/i486-pc-linux-gnu-library/2.9/tm’
* Restoring previous ‘/home/ctelmo/R/i486-pc-linux-gnu-library/2.9/tm’

The downloaded packages are in
‘/tmp/RtmptL3R1F/downloaded_packages’
Warning message:
In install.packages("tm") :
  installation of package 'tm' had non-zero exit status

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Residual DF of NLS models (PR#14194)

2010-01-26 Thread han
Full_Name: Henrik Aalborg Nielsen
Version: 2.10
OS: Linux (SLES 10 / openSUSE 11.1)
Submission from: (NULL) (77.66.63.89)


There seems to be a bug in df.residual.nls which is triggered when nls is called
with argument na.action = na.exclude; in that case 'resid(object)' will contain
NA-values which should be disregarded when counting the number of residuals:

df.residual.nls <- function(object, ...) {
w <- object$weights
n <- if(!is.null(w)) sum(w != 0) else length(resid(object))
n - length(coef(object))
}

The bug cause the F-test of anova.nls to be wrong.

Replace 'length(resid(object))' with 'sum(!is.na(resid(object)))' ?

... and thank you for producing this fantastic software!

BR
Henrik

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Residual DF of NLS models (PR#14194)

2010-01-26 Thread Prof Brian Ripley
Can we please have a reproducible example (as we did ask in the 
FAQ, the posting guide ...).


On Tue, 26 Jan 2010, h...@enfor.dk wrote:


Full_Name: Henrik Aalborg Nielsen
Version: 2.10
OS: Linux (SLES 10 / openSUSE 11.1)
Submission from: (NULL) (77.66.63.89)


There seems to be a bug in df.residual.nls which is triggered when nls is called
with argument na.action = na.exclude; in that case 'resid(object)' will contain
NA-values which should be disregarded when counting the number of residuals:

df.residual.nls <- function(object, ...) {
   w <- object$weights
   n <- if(!is.null(w)) sum(w != 0) else length(resid(object))
   n - length(coef(object))
}

The bug cause the F-test of anova.nls to be wrong.

Replace 'length(resid(object))' with 'sum(!is.na(resid(object)))' ?

... and thank you for producing this fantastic software!

BR
Henrik

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] tm installation (PR#14193)

2010-01-26 Thread ligges


On 25.01.2010 17:20, cte...@ua.pt wrote:
> Full_Name: Cesar Telmo Costa
> Version: R version 2.9.2 (2009-08-24)
> OS: Ubuntu kermic
> Submission from: (NULL) (85.241.174.237)
>
>
> AFTER install.packages("tm"):


- A problem with a contributed package is *not* a bug in R, it *may be* 
one in the package.
- Such problems should be reported to the package maintainer.
- Please always test with the current release version of R (which 
happens to be R-2.10.1) before reporting.
- In this case I suspect the package maintainer (CCing) forgot to 
declare the package to depend on R >= 2.10.0 (untested!).

Uwe Ligges





> downloaded 317 Kb
>
> * Installing *source* package ‘tm’ ...
> ** libs
> gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c lazyTmMap.c -o
> lazyTmMap.o
> gcc -std=gnu99 -shared -o tm.so lazyTmMap.o -L/usr/lib/R/lib -lR
> ** R
> ** data
> ** inst
> ** preparing package for lazy loading
> Error in setOldClass(c("VCorpus", "Corpus", "list")) :
>inconsistent old-style class information for "list"; the class is defined 
> but
> does not extend "oldClass"
> Error : unable to load R code in package 'tm'
> ERROR: lazy loading failed for package ‘tm’
> * Removing ‘/home/ctelmo/R/i486-pc-linux-gnu-library/2.9/tm’
> * Restoring previous ‘/home/ctelmo/R/i486-pc-linux-gnu-library/2.9/tm’
>
> The downloaded packages are in
>  ‘/tmp/RtmptL3R1F/downloaded_packages’
> Warning message:
> In install.packages("tm") :
>installation of package 'tm' had non-zero exit status
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Stack smashing in RODBC

2010-01-26 Thread Tom "spot" Callaway
On 01/26/2010 06:17 AM, Dirk Eddelbuettel wrote:
> 
> On 26 January 2010 at 01:23, "Tom \"spot\" Callaway" wrote:
> | On 01/25/2010 09:14 PM, Dirk Eddelbuettel wrote:
> | > I cannot replicate this on Debian. The error gets trapped just fine. This 
> may
> | > be particular to your builds or setup. I don;t see an R error (but of 
> course
> | > do not speak for R Core). Here is a short version, it is the same in 
> normal
> | > interactive mode.
> | 
> | I don't think Debian builds with stack protection in glibc, whereas
> | Fedora does (and I think Ubuntu Hardy and onward also do).
> 
> As I get the exact same result on Ubuntu, I continue to suspect that the
> issue with Fedora.

We're not modifying the RODBC or R code at all, so I suspect that it is
a legitimate bug that Fedora is better at reproducing.

The Fedora optflags tend to be more restrictive than some other Linux
distributions, here is how RODBC is compiled by default:

gcc -m32 -std=gnu99 -I/usr/include/R -I. -I/usr/local/include-fpic
-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom
-fasynchronous-unwind-tables -c RODBC.c -o RODBC.o
gcc -m32 -std=gnu99 -shared -L/usr/local/lib -o RODBC.so RODBC.o -lodbc
-L/usr/lib/R/lib -lR

I compiled RODBC without any -O and with -ggdb for debugging, but it
didn't prevent the crash.

[s...@f12.i386 ~]$ echo 'library(RODBC); channel <- odbcConnect("foo",
uid="bar")' | R --slave
*** stack smashing detected ***: /usr/lib/R/bin/exec/R terminated
=== Backtrace: =
/lib/libc.so.6(__fortify_fail+0x4d)[0x2041ed]
/lib/libc.so.6(-0xffa62e66)[0x20419a]
/usr/lib/R/library/RODBC/libs/RODBC.so(+0x6164)[0x2c9164]
/usr/lib/R/library/RODBC/libs/RODBC.so(RODBCDriverConnect+0x4ed)[0x2c5072]
/usr/lib/R/lib/libR.so[0x85c01c]
/usr/lib/R/lib/libR.so(Rf_eval+0x7f2)[0x87fa82]
/usr/lib/R/lib/libR.so[0x881fd5]
/usr/lib/R/lib/libR.so(Rf_eval+0x568)[0x87f7f8]
/usr/lib/R/lib/libR.so[0x8820eb]
/usr/lib/R/lib/libR.so(Rf_eval+0x568)[0x87f7f8]
/usr/lib/R/lib/libR.so(Rf_applyClosure+0x2e7)[0x883ac7]
/usr/lib/R/lib/libR.so(Rf_eval+0x40d)[0x87f69d]
/usr/lib/R/lib/libR.so[0x88043a]
/usr/lib/R/lib/libR.so[0x8cbe9e]
/usr/lib/R/lib/libR.so(Rf_eval+0x568)[0x87f7f8]
/usr/lib/R/lib/libR.so(Rf_applyClosure+0x2e7)[0x883ac7]
/usr/lib/R/lib/libR.so(Rf_eval+0x40d)[0x87f69d]
/usr/lib/R/lib/libR.so[0x8820eb]
/usr/lib/R/lib/libR.so(Rf_eval+0x568)[0x87f7f8]
/usr/lib/R/lib/libR.so(Rf_applyClosure+0x2e7)[0x883ac7]
/usr/lib/R/lib/libR.so(Rf_eval+0x40d)[0x87f69d]
/usr/lib/R/lib/libR.so[0x8820eb]
/usr/lib/R/lib/libR.so(Rf_eval+0x568)[0x87f7f8]
/usr/lib/R/lib/libR.so(Rf_applyClosure+0x2e7)[0x883ac7]
/usr/lib/R/lib/libR.so(Rf_eval+0x40d)[0x87f69d]
/usr/lib/R/lib/libR.so[0x881fd5]
/usr/lib/R/lib/libR.so(Rf_eval+0x568)[0x87f7f8]
/usr/lib/R/lib/libR.so(Rf_ReplIteration+0x23d)[0x8ba64d]
/usr/lib/R/lib/libR.so[0x8ba9a5]
/usr/lib/R/lib/libR.so(run_Rmainloop+0x66)[0x8bb236]
/usr/lib/R/lib/libR.so(Rf_mainloop+0x1d)[0x8bb26d]
/usr/lib/R/bin/exec/R(main+0x39)[0x8048699]
/lib/libc.so.6(__libc_start_main+0xe6)[0x126bb6]
/usr/lib/R/bin/exec/R[0x8048591]
=== Memory map: 
0011-0027f000 r-xp  fd:00 463/lib/libc-2.11.1.so
0027f000-00281000 r--p 0016e000 fd:00 463/lib/libc-2.11.1.so
00281000-00282000 rw-p 0017 fd:00 463/lib/libc-2.11.1.so
00282000-00285000 rw-p  00:00 0
00285000-0029b000 r-xp  fd:00 17315  /lib/libtinfo.so.5.7
0029b000-0029e000 rw-p 00015000 fd:00 17315  /lib/libtinfo.so.5.7
0029e000-002bb000 r-xp  fd:00 356
/lib/libgcc_s-4.4.2-20091222.so.1
002bb000-002bc000 rw-p 0001c000 fd:00 356
/lib/libgcc_s-4.4.2-20091222.so.1
002bc000-002c2000 r-xp  fd:00 225678
/usr/lib/R/library/methods/libs/methods.so
002c2000-002c3000 rw-p 5000 fd:00 225678
/usr/lib/R/library/methods/libs/methods.so
002c3000-002cb000 r-xp  fd:00 22
/usr/lib/R/library/RODBC/libs/RODBC.so
002cb000-002cc000 rw-p 7000 fd:00 22
/usr/lib/R/library/RODBC/libs/RODBC.so
002cc000-002cd000 rw-p  00:00 0
002cd000-00339000 r-xp  fd:00 25406  /usr/lib/libodbc.so.2.0.0
00339000-0033e000 rw-p 0006b000 fd:00 25406  /usr/lib/libodbc.so.2.0.0
00487000-004a5000 r-xp  fd:00 462/lib/ld-2.11.1.so
004a5000-004a6000 r--p 0001d000 fd:00 462/lib/ld-2.11.1.so
004a6000-004a7000 rw-p 0001e000 fd:00 462/lib/ld-2.11.1.so
004e2000-00538000 r-xp  fd:00 226761
/usr/lib/R/library/stats/libs/stats.so
00538000-0053a000 rw-p 00055000 fd:00 226761
/usr/lib/R/library/stats/libs/stats.so
0053c000-0053d000 r-xp  00:00 0  [vdso]
005bd000-005c8000 r-xp  fd:00 31904  /lib/libnss_files-2.11.1.so
005c8000-005c9000 r--p a000 fd:00 31904  /lib/libnss_files-2.11.1.so
005c9000-005ca000 rw-p b000 fd:00 31904  /lib/libnss_files-2.11.1.so
0062-00623000 r-xp  fd:00 479/lib/libdl-2.11.1.so
00623000-00624000 r--p 2000 fd:00 479 

[Rd] AD: advanced R course - June 28-30, Seattle.

2010-01-26 Thread Thomas Lumley


The Summer Institute in Statistical Genetics at the University of Washington 
will include a 2.5 day course in Advanced R Programming, on June 28-30. 

The course will cover object-oriented programming, SQL and netCDF data access, 
calling compiled code, creating R packages, and using some of the software 
infrastructure from the Bioconductor project.

The instructors will be Thomas Lumley and Ken Rice. 

Further details on this and the other 21 modules at the Summer Institute are 
available from http://sisg.biostat.washington.edu/.  I will just note that this 
is the University of Washington, in Seattle (not DC, or St Louis) and that  
June 28-30 is at the beginning of Seattle's non-rainy season

 -thomas

Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity of Washington, Seattle

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Residual DF of NLS models (PR#14194)

2010-01-26 Thread Henrik Aalborg Nielsen
OK - I do think the bug is pretty obvious when looking at the code (and
remembering that resid(object) may contain NA's). Anyway, I've attached
a script and the output (from 'R CMD BATCH --vanilla').

BR
Henrik


On Tue, 2010-01-26 at 12:04 +, Prof Brian Ripley wrote:

> Can we please have a reproducible example (as we did ask in the 
> FAQ, the posting guide ...).
> 
> On Tue, 26 Jan 2010, h...@enfor.dk wrote:
> 
> > Full_Name: Henrik Aalborg Nielsen
> > Version: 2.10
> > OS: Linux (SLES 10 / openSUSE 11.1)
> > Submission from: (NULL) (77.66.63.89)
> >
> >
> > There seems to be a bug in df.residual.nls which is triggered when nls is 
> > called
> > with argument na.action = na.exclude; in that case 'resid(object)' will 
> > contain
> > NA-values which should be disregarded when counting the number of residuals:
> >
> > df.residual.nls <- function(object, ...) {
> >w <- object$weights
> >n <- if(!is.null(w)) sum(w != 0) else length(resid(object))
> >n - length(coef(object))
> > }
> >
> > The bug cause the F-test of anova.nls to be wrong.
> >
> > Replace 'length(resid(object))' with 'sum(!is.na(resid(object)))' ?
> >
> > ... and thank you for producing this fantastic software!
> >
> > BR
> > Henrik
> >
> > __
> > R-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
> 

R version 2.10.1 (2009-12-14)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> ## Example demonstating bug PR#14194 (based on the help-page of nls)
> 
> utils::data(muscle, package = "MASS")
> 
> musc.1 <- nls(Length ~ cbind(1, exp(-Conc/th)), muscle,
+   start = list(th=1), algorithm="plinear")
> 
> b <- coef(musc.1)
> musc.2 <- nls(Length ~ a[Strip] + b[Strip]*exp(-Conc/th),
+   muscle,
+   start = list(a=rep(b[2],21), b=rep(b[3],21), th=b[1]))
> 
> ## Adding data with response 'NA'
> muscle2 <- muscle
> muscle2[,"Length"] <- NA
> muscle2 <- rbind(muscle, muscle2)
> 
> musc2.1 <- nls(Length ~ cbind(1, exp(-Conc/th)), muscle2, 
> na.action=na.exclude,
+   start = list(th=1), algorithm="plinear")
> 
> b <- coef(musc2.1)
> musc2.2 <- nls(Length ~ a[Strip] + b[Strip]*exp(-Conc/th),
+   muscle2, na.action=na.exclude,
+   start = list(a=rep(b[2],21), b=rep(b[3],21), th=b[1]))
> 
> ## Thes two ANOVA's should be identical:
> anova(musc.1, musc.2)
Analysis of Variance Table

Model 1: Length ~ cbind(1, exp(-Conc/th))
Model 2: Length ~ a[Strip] + b[Strip] * exp(-Conc/th)
  Res.Df Res.Sum Sq Df Sum Sq F valuePr(>F)
1 571241.09
2 17  21.13 40 1220.0  24.538 2.721e-09 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ 
’ 1 
> anova(musc2.1, musc2.2)
Analysis of Variance Table

Model 1: Length ~ cbind(1, exp(-Conc/th))
Model 2: Length ~ a[Strip] + b[Strip] * exp(-Conc/th)
  Res.Df Res.Sum Sq Df Sum Sq F valuePr(>F)
11171241.09
2 77  21.13 40 1220.0  111.14 < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ 
’ 1 
> ## ... but the F-values are different.
> 
> ## DF:
> df.residual(musc.1)
[1] 57
> df.residual(musc2.1)
[1] 117
> length(residuals(musc2.1))
[1] 120
> sum(!is.na(residuals(musc2.1))) - length(coef(musc2.1))
[1] 57
> 
> ## Workaround:
> anova(update(musc2.1, na.action=na.omit), update(musc2.2, na.action=na.omit))
Analysis of Variance Table

Model 1: Length ~ cbind(1, exp(-Conc/th))
Model 2: Length ~ a[Strip] + b[Strip] * exp(-Conc/th)
  Res.Df Res.Sum Sq Df Sum Sq F valuePr(>F)
1 571241.09
2 17  21.13 40 1220.0  24.538 2.721e-09 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ 
’ 1 
> 
> proc.time()
   user  system elapsed 
  0.376   0.028   0.398 
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] poisson.test from stats package does not pass the conf.level (PR#14195)

2010-01-26 Thread mfay
Hi,

The poisson.test function from stats package does not pass the conf.level p=
arameter for the two-sample test. Here is an example:

poisson.test(c(2,4),c(20,14),conf.level=3D.95)$conf.int
poisson.test(c(2,4),c(20,14),conf.level=3D.9)$conf.int


Here is the solution, change:

RVAL <- binom.test(x, sum(x), r * T[1]/(r * T[1] + T[2]),
alternative =3D alternative)

to:

RVAL <- binom.test(x, sum(x), r * T[1]/(r * T[1] + T[2]),
alternative =3D alternative, conf.level=3Dconf.level)



Mike

--please do not edit the information below--

Version:
 platform =3D i386-pc-mingw32
 arch =3D i386
 os =3D mingw32
 system =3D i386, mingw32
 status =3D
 major =3D 2
 minor =3D 10.1
 year =3D 2009
 month =3D 12
 day =3D 14
 svn rev =3D 50720
 language =3D R
 version.string =3D R version 2.10.1 (2009-12-14)

Windows XP (build 2600) Service Pack 2

Locale:
LC_COLLATE=3DEnglish_United States.1252;LC_CTYPE=3DEnglish_United States.12=
52;LC_MONETARY=3DEnglish_United States.1252;LC_NUMERIC=3DC;LC_TIME=3DEnglis=
h_United States.1252

Search Path:
 .GlobalEnv, package:stats, package:graphics, package:grDevices, package:ut=
ils, package:datasets, package:methods, Autoloads, package:base

**
Michael P. Fay, PhD
Mathematical Statistician
National Institute of Allergy and Infectious Diseases
Tel: 301-451-5124   Fax:301-480-0912
(U.S. postal mail address)
6700B Rockledge Drive MSC 7609
Bethesda, MD 20892-7609
(Overnight mail address)
6700-A Rockledge Drive, Room 5133
Bethesda, MD 20817
http://www3.niaid.nih.gov/about/organization/dcr/BRB/staff/michael.htm
**
Disclaimer:
The information in this e-mail and any of its attachment...{{dropped:3}}

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel