Re: [Rd] Problem with tuned Rblas from CRAN with R-2.4.0

2006-12-12 Thread Uwe Ligges
I just looked into the one for P4 and it does export zdrot_ and works 
for me. Is your one from CRAN master?

Uwe Ligges


Daniel Nordlund wrote:
> I encountered the following problem in R-2.4.0 for Windows binary downloaded 
> from CRAN (data from R-help post by Ethan Johnsons).  I was also using the 
> contributed binary Rblas.dll for Intel P4 chip.  The problem doesn't occur 
> with the default Rblas.dll. 
> 
> 
> x=c(3.05176E-05, 0.000457764, 0.003204346, 0.0138855, 0.04165649, 0.09164429, 
> 0.1527405, 0.1963806, 0.1963806, 0.1527405, 0.09164429, 0.04165649, 
> 0.0138855, 0.003204346, 0.000457764, 3.05176E-05)
> y=c(0.306, 0.0004566, 0.0031985, 0.0139083, 0.0415539, 0.0917678, 
> 0.1528134, 0.1962831, 0.1962994, 0.1527996, 0.0917336, 0.0415497, 0.0139308, 
> 0.0031917, 0.0004529, 0.301)
> fit.lm<-lm(y~x)
> summary(fit.lm)
> 
> I got the following popup window error message
> 
>The procedure entry point zdrot_ could not be found in the dynamic link 
> library Rblas.dll
> 
> 
> After closing the popup, the following was printed in the console:
> 
> Error in chol2inv(Qr$qr[p1, p1, drop = FALSE]) : 
> lapack routines cannot be loaded
> In addition: Warning message:
> unable to load shared library 'C:\R\R-2.4.1beta/modules//lapack.dll':
>   LoadLibrary failure:  The specified procedure could not be found.
> 
> I subsequently downloaded R-2.4.1beta from CRAN and had the same problem with 
> the contributed binary Rblas.dll 
> 
> 
> platform   i386-pc-mingw32 
> arch   i386
> os mingw32 
> system i386, mingw32   
> status beta
> major  2   
> minor  4.1 
> year   2006
> month  12  
> day07  
> svn rev40137   
> language   R   
> version.string R version 2.4.1 beta (2006-12-07 r40137)
> 
> OS:  WinXP Pro service pack 2
> 
> I haven't had any problems with the contributed binary up thru R-2.3.1.  I 
> checked the changes file and saw that for R-2.4.0 the Rblas.dll would have to 
> be recompiled, but also that the contributed binaries on CRAN had been 
> updated.  However, I couldn’t find any Rblas binaries with a date after 2005. 
>  Any suggestions on where to find an Rblas binary for WinXP and P4 chip, or 
> do I need to try to compile one on my own?
> 
> Thanks for any assistance,
> 
> Dan
> 
> Daniel Nordlund
> Bothell, WA  USA
> 
> __
> 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


[Rd] Problem with tuned Rblas from CRAN with R-2.4.0

2006-12-12 Thread Daniel Nordlund
I encountered the following problem in R-2.4.0 for Windows binary downloaded 
from CRAN (data from R-help post by Ethan Johnsons).  I was also using the 
contributed binary Rblas.dll for Intel P4 chip.  The problem doesn't occur with 
the default Rblas.dll. 


x=c(3.05176E-05, 0.000457764, 0.003204346, 0.0138855, 0.04165649, 0.09164429, 
0.1527405, 0.1963806, 0.1963806, 0.1527405, 0.09164429, 0.04165649, 0.0138855, 
0.003204346, 0.000457764, 3.05176E-05)
y=c(0.306, 0.0004566, 0.0031985, 0.0139083, 0.0415539, 0.0917678, 
0.1528134, 0.1962831, 0.1962994, 0.1527996, 0.0917336, 0.0415497, 0.0139308, 
0.0031917, 0.0004529, 0.301)
fit.lm<-lm(y~x)
summary(fit.lm)

I got the following popup window error message

   The procedure entry point zdrot_ could not be found in the dynamic link 
library Rblas.dll


After closing the popup, the following was printed in the console:

Error in chol2inv(Qr$qr[p1, p1, drop = FALSE]) : 
lapack routines cannot be loaded
In addition: Warning message:
unable to load shared library 'C:\R\R-2.4.1beta/modules//lapack.dll':
  LoadLibrary failure:  The specified procedure could not be found.

I subsequently downloaded R-2.4.1beta from CRAN and had the same problem with 
the contributed binary Rblas.dll 


platform   i386-pc-mingw32 
arch   i386
os mingw32 
system i386, mingw32   
status beta
major  2   
minor  4.1 
year   2006
month  12  
day07  
svn rev40137   
language   R   
version.string R version 2.4.1 beta (2006-12-07 r40137)

OS:  WinXP Pro service pack 2

I haven't had any problems with the contributed binary up thru R-2.3.1.  I 
checked the changes file and saw that for R-2.4.0 the Rblas.dll would have to 
be recompiled, but also that the contributed binaries on CRAN had been updated. 
 However, I couldn’t find any Rblas binaries with a date after 2005.  Any 
suggestions on where to find an Rblas binary for WinXP and P4 chip, or do I 
need to try to compile one on my own?

Thanks for any assistance,

Dan

Daniel Nordlund
Bothell, WA  USA

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


Re: [Rd] Pre-compilation and server-side parallel execution

2006-12-12 Thread Byron Ellis
On 12/8/06, Erik van Zijst <[EMAIL PROTECTED]> wrote:
> 2. R's native C-api
> [http://cran.r-project.org/doc/manuals/R-exts.html#The-R-API] does not
> separate parsing from evaluation. When the same script is evaluated 10
> times, it is also parsed 10 times.
>
> I'm mostly concerned about the second issue. Our scripts are registered
> once and continuously evaluated. I want to avoid parsing the same script
> again each time it is evaluated. Does the engine recognize previously
> parsed scripts (like oracle does for SQL queries)?

A database server is doing rather more than simply parsing a
query--it's also running a query planner to optimize execution and
quite possibly a number of other things so it behooves the DBMS to
cache that information whenever possible. The closest functional
equivalent in R would be wrapping everything in a function and then
serializing the resulting function somewhere.

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


Re: [Rd] [R] Segfault in pure R code

2006-12-12 Thread Peter Dalgaard
Göran Broström wrote:
> I tried once more under the debugger, and
>
> ++
> [EMAIL PROTECTED]:~/R/BEMANNING/Doc$ R -d gdb
> GNU gdb 6.5-debian
> Copyright (C) 2006 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "i486-linux-gnu"...Using host libthread_db
> library "/lib/tls/i686/cmov/libthread_db.so.1".
>
> (gdb) run
> Starting program: /usr/local/lib/R/bin/exec/R
> Failed to read a valid object file image from memory.
>
> R version 2.4.0 Patched (2006-10-29 r39744)
> Copyright (C) 2006 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.
>
> [Previously saved workspace restored]
>
>   
>> library(xtable)
>> ?xtable)
>> 
> Error: syntax error in "?xtable)"
>   
>> ?xtable
>> help.start()
>> 
> Making links in per-session dir ...
> If '/usr/bin/firefox' is already running, it is *not* restarted, and
> you must switch to its window.
> Otherwise, be patient ...
>   
>> library(bemanning)
>> load("bemanning07-32.rda")
>> courses("Ingrid")
>> 
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x080f5026 in R_gc_internal (size_needed=17588127) at memory.c:1313
> 1313PROCESS_NODES();
> (gdb)
> 
>
> How do I continue?
>   

Ouch.  Call the marines...

The error comes from the garbage collector, which means that something 
got corrupted in internal data structures some time previously.

The most important thing is to preserve the bug. Rebuild anything and 
the symptom disappears, but the bug will still be there. So keep the R 
binary, the script, and the .RData file around.

Some ideas:

Is it reproducible on other machines?

Do you have valgrind installed? Notes for using it are on 
http://developer.r-project.org/valgrind-internal.html

Turning on gctorture() may trigger the bug at an earlier state.

The last resort is to painstakingly backtrace to the point of the 
damage  using  watchpoints and whatever, but I'd rather not go there 
right away.

 -p
> Göran
>
> On 12/12/06, Göran Broström <[EMAIL PROTECTED]> wrote:
>   
>> On 12/12/06, Peter Dalgaard <[EMAIL PROTECTED]> wrote:
>> 
>>> Göran Broström wrote:
>>>   
 I just caught a segfault:


 
> courses("Ingrid")
>
>   
  *** caught segfault ***
 address 0x99b279c, cause 'memory not mapped'

 Traceback:
  1: structure(y, class = oldClass(x), row.names = attr(x, "row.names"))
  2: `[.data.frame`(gudata, -(1:5))
  3: gudata[-(1:5)]
  4: names(gudata[-(1:5)])
  5: inherits(x, "factor")
  6: is.factor(table)
  7: match(x, table, nomatch = 0)
  8: who %in% names(gudata[-(1:5)])
  9: courses("Ingrid")

 when running a function 'courses' in an R package without compiled
 code. Is this "possible"? I have got many segfaults when testing my
 own packages, but it has always been caused by stupidities in C or
 Fortran code, never with pure R code.

 So, before I start debugging, I'd like to know if a segfault in pure R
 code indicates  a bug in R itself, or if it can be in my function?


 
>>> By definition, reproducible segfaults in R code are bugs in R, unless
>>> caused by abuse of .C calls or similar. (Irreproducible ones are often
>>> hardware faults.)
>>>
>>> However, at least presently, you are the only one with a handle on the
>>> bug. So either you get to do the debugging or you have to provide
>>> something that others can reproduce.
>>>
>>> Astarting point could be to run R under the debugger (R -d gdb)  and
>>> generate a C backtrace, then look at the variables involved.
>>>   
>> Thanks, Peter,
>>
>> the error is reproducible. The full session is
>>
>> +
>> [EMAIL PROTECTED]:~/R/BEMANNING/Doc$ R
>>
>> R version 2.4.0 Patched (2006-10-29 r39744)
>> Copyright (C) 2006 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 dis

Re: [Rd] [R] Segfault in pure R code

2006-12-12 Thread Prof Brian Ripley

That's in the memory manager and indicates prior memory corruption.
Please re-run under valgrind, plus gctorture(TRUE) if needed.

However, I would start by seeing if this occurs in a single-byte domain if 
this was in a UTF-8 domain.  Experience suggests that we have some flakier 
code in the less-used MBCS pathways.



On Tue, 12 Dec 2006, Göran Broström wrote:


I tried once more under the debugger, and

++
[EMAIL PROTECTED]:~/R/BEMANNING/Doc$ R -d gdb
GNU gdb 6.5-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...Using host libthread_db
library "/lib/tls/i686/cmov/libthread_db.so.1".

(gdb) run
Starting program: /usr/local/lib/R/bin/exec/R
Failed to read a valid object file image from memory.

R version 2.4.0 Patched (2006-10-29 r39744)
Copyright (C) 2006 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.

[Previously saved workspace restored]


library(xtable)
?xtable)

Error: syntax error in "?xtable)"

?xtable
help.start()

Making links in per-session dir ...
If '/usr/bin/firefox' is already running, it is *not* restarted, and
   you must switch to its window.
Otherwise, be patient ...

library(bemanning)
load("bemanning07-32.rda")
courses("Ingrid")


Program received signal SIGSEGV, Segmentation fault.
0x080f5026 in R_gc_internal (size_needed=17588127) at memory.c:1313
1313PROCESS_NODES();
(gdb)


How do I continue?

Göran

On 12/12/06, Göran Broström <[EMAIL PROTECTED]> wrote:

On 12/12/06, Peter Dalgaard <[EMAIL PROTECTED]> wrote:

Göran Broström wrote:

I just caught a segfault:



courses("Ingrid")



 *** caught segfault ***
address 0x99b279c, cause 'memory not mapped'

Traceback:
 1: structure(y, class = oldClass(x), row.names = attr(x, "row.names"))
 2: `[.data.frame`(gudata, -(1:5))
 3: gudata[-(1:5)]
 4: names(gudata[-(1:5)])
 5: inherits(x, "factor")
 6: is.factor(table)
 7: match(x, table, nomatch = 0)
 8: who %in% names(gudata[-(1:5)])
 9: courses("Ingrid")

when running a function 'courses' in an R package without compiled
code. Is this "possible"? I have got many segfaults when testing my
own packages, but it has always been caused by stupidities in C or
Fortran code, never with pure R code.

So, before I start debugging, I'd like to know if a segfault in pure R
code indicates  a bug in R itself, or if it can be in my function?



By definition, reproducible segfaults in R code are bugs in R, unless
caused by abuse of .C calls or similar. (Irreproducible ones are often
hardware faults.)

However, at least presently, you are the only one with a handle on the
bug. So either you get to do the debugging or you have to provide
something that others can reproduce.

Astarting point could be to run R under the debugger (R -d gdb)  and
generate a C backtrace, then look at the variables involved.


Thanks, Peter,

the error is reproducible. The full session is

+
[EMAIL PROTECTED]:~/R/BEMANNING/Doc$ R

R version 2.4.0 Patched (2006-10-29 r39744)
Copyright (C) 2006 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.

[Previously saved workspace restored]


library(xtable)
?xtable)

Error: syntax error in "?xtable)"

?xtable
help.start()

Making links in per-session dir ...
If '/usr/bin/firefox' is already running, it is *not* restarted, and
you must switch to its window.
Otherwise, be patient ...

library(bemanning)
load("bemanning07-32.rda")
courses("Ingrid")


 *** caught segfault ***
address 0x99b279c, cause 'memory not mapped'

Traceback:
 1: structure(y, class =

Re: [Rd] include libraries for C code called from R

2006-12-12 Thread Prof Brian Ripley
Just a note: if you do need -L, it would almost certainly be -L/usr/lib64
on this system.

As a diagnostic check, try

nm -g /mnt/san2/braunm/winshare/braunm/Cpractice/RgslTest.so

which will probably have 'U' for lots of symbols from gsl.

On Tue, 12 Dec 2006, Duncan Temple Lang wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi Michael.
>
> [There's no need to send two pieces of mail that are essentially the
> same issue.]
>
> The problem is that when you are creating the shared object
> gslTestHG.so, you are not telling the linker to combine information
> from the libgsl.so or libgsl.a file.  The linker needs that to resolve
> the symbols that were referenced in your RgslTest.c code.
> Without this, the linker then assumes that these missing symbols will be
> found when the .so is loaded, i.e. in the host application, namely R.
> Compiling, linking and loading are three different steps in this
> process. It helps to diagnose problems if one has an understanding
> of what each does (approximately). Otherwise, the error messages
> can be cryptic.
>
> One way to fix the problem is to create a file names Makevars in the
> same directory as  RgslTest.c and add to it
>
>  PKG_CPPFLAGS=-I/usr/include
>  PKG_LIBS=-L/usr/lib -lgsl
>
> The second of these lines tells the linker to include the symbols in
> libgsl.so or libgsl.a  and that it should look for this in /usr/lib/
> (You may have to change this, but it looks like that is where you have
> gsl installed juding from the #include).
> The -I/usr/include and -L/usr/lib  are likely to be unnecessary
> but illustrate the idea that one adds library-specific include
> and library directories to allow the compiler and linker
> respectively find files it needs for that library's code.
>
> And change your RgslTest.c code to have
>   #include 
> not the full path name to the .h file.
>
>
> D.
>
>
> [EMAIL PROTECTED] wrote:
>> I hope that someone on this list can help me with this issue.  I have 
>> searched
>> through all of the documentation and mail archives for a solution, but have
>> been unable to find an answer that addresses my particular problem directly.
>>
>> Suppose I am writing some C code that I want to access from R through the .C
>> function.  As part of the C function, I want to include an external C 
>> library,
>> such as the GNU gsl library.  So, if I want to compute the value of a 
>> Gaussian
>> hypergeometric function, my C code would be:
>>
>> #include 
>> void gslTestHG (double *a, double *b, double *c, double *x, double *val ) {
>>
>>  *val = gsl_sf_hyperg_2F1(*a,*b,*c,*x);
>> }
>>
>> I then compile this file (successfully, on a Linux machine with gcc 
>> installed)
>> using R CMD SHLIB gslTest.c.  The message from the complier is:
>>
>> gcc -I/usr/lib64/R/include -I/usr/lib64/R/include  -I/usr/local/include   
>> -fpic
>> -O2 -g -c RgslTest.c -o RgslTest.o
>> gcc -shared -L/usr/local/lib64 -o RgslTest.so RgslTest.o -L/usr/lib64/R/lib 
>> -lR
>>
>>
>> When I go into R and enter the command dyn.load("gslTestHG.so"), I get the
>> following error:
>>
>> Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load 
>> shared
>> library '/mnt/san2/braunm/winshare/braunm/Cpractice/RgslTest.so':
>>   /mnt/san2/braunm/winshare/braunm/Cpractice/RgslTest.so: undefined symbol:
>> gsl_sf_hyperg_2F1
>>
>> So, it looks like R is not recognizing the function call within my own C
>> function, even though the library was included.
>>
>> Note that this is a simpler example of my "real" problem, the details of 
>> which
>> would bog down discussion.  I know that I could use the gsl package, or 
>> include
>> the Rmath.h library, to perform this particular task.  My primary need is the
>> ability to call C libraries from wtihin my own C code.
>>
>> But I would greatly appreciate any advice or suggestions on how to solve this
>> problem.  I am a novice C programmer and Linux user, but it seems like this
>> should be a simple fix.
>>
>> Many thanks in advance,
>>
>> Michael Braun
>> MIT Sloan School of Management
>> [EMAIL PROTECTED]
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> - --
> Duncan Temple Lang[EMAIL PROTECTED]
> Department of Statistics  work:  (530) 752-4782
> 4210 Mathematical Sciences Building   fax:   (530) 752-7099
> One Shields Ave.
> University of California at Davis
> Davis,
> CA 95616,
> USA
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.3 (Darwin)
>
> iD8DBQFFfyRR9p/Jzwa2QP4RAvBBAJ9nNDK4kWNt2fpCv9pw/r3XPpq6VQCfU9CL
> ziDU+0OcPTEJgVV1RR/OFvA=
> =oMxN
> -END PGP SIGNATURE-
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +4

Re: [Rd] [R] Segfault in pure R code

2006-12-12 Thread Göran Broström
I tried once more under the debugger, and

++
[EMAIL PROTECTED]:~/R/BEMANNING/Doc$ R -d gdb
GNU gdb 6.5-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...Using host libthread_db
library "/lib/tls/i686/cmov/libthread_db.so.1".

(gdb) run
Starting program: /usr/local/lib/R/bin/exec/R
Failed to read a valid object file image from memory.

R version 2.4.0 Patched (2006-10-29 r39744)
Copyright (C) 2006 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.

[Previously saved workspace restored]

> library(xtable)
> ?xtable)
Error: syntax error in "?xtable)"
> ?xtable
> help.start()
Making links in per-session dir ...
If '/usr/bin/firefox' is already running, it is *not* restarted, and
you must switch to its window.
Otherwise, be patient ...
> library(bemanning)
> load("bemanning07-32.rda")
> courses("Ingrid")

Program received signal SIGSEGV, Segmentation fault.
0x080f5026 in R_gc_internal (size_needed=17588127) at memory.c:1313
1313PROCESS_NODES();
(gdb)


How do I continue?

Göran

On 12/12/06, Göran Broström <[EMAIL PROTECTED]> wrote:
> On 12/12/06, Peter Dalgaard <[EMAIL PROTECTED]> wrote:
> > Göran Broström wrote:
> > > I just caught a segfault:
> > >
> > >
> > >> courses("Ingrid")
> > >>
> > >
> > >  *** caught segfault ***
> > > address 0x99b279c, cause 'memory not mapped'
> > >
> > > Traceback:
> > >  1: structure(y, class = oldClass(x), row.names = attr(x, "row.names"))
> > >  2: `[.data.frame`(gudata, -(1:5))
> > >  3: gudata[-(1:5)]
> > >  4: names(gudata[-(1:5)])
> > >  5: inherits(x, "factor")
> > >  6: is.factor(table)
> > >  7: match(x, table, nomatch = 0)
> > >  8: who %in% names(gudata[-(1:5)])
> > >  9: courses("Ingrid")
> > >
> > > when running a function 'courses' in an R package without compiled
> > > code. Is this "possible"? I have got many segfaults when testing my
> > > own packages, but it has always been caused by stupidities in C or
> > > Fortran code, never with pure R code.
> > >
> > > So, before I start debugging, I'd like to know if a segfault in pure R
> > > code indicates  a bug in R itself, or if it can be in my function?
> > >
> > >
> > By definition, reproducible segfaults in R code are bugs in R, unless
> > caused by abuse of .C calls or similar. (Irreproducible ones are often
> > hardware faults.)
> >
> > However, at least presently, you are the only one with a handle on the
> > bug. So either you get to do the debugging or you have to provide
> > something that others can reproduce.
> >
> > Astarting point could be to run R under the debugger (R -d gdb)  and
> > generate a C backtrace, then look at the variables involved.
>
> Thanks, Peter,
>
> the error is reproducible. The full session is
>
> +
> [EMAIL PROTECTED]:~/R/BEMANNING/Doc$ R
>
> R version 2.4.0 Patched (2006-10-29 r39744)
> Copyright (C) 2006 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.
>
> [Previously saved workspace restored]
>
> > library(xtable)
> > ?xtable)
> Error: syntax error in "?xtable)"
> > ?xtable
> > help.start()
> Making links in per-session dir ...
> If '/usr/bin/firefox' is already running, it is *not* restarted, and
> you must switch to its window.
> Otherwise, be patient ...
> > library(bemanning)
> > load("bemanning07-32.rda")
> > courses("Ingrid")
>
>  *** caught segfault ***
> address 0x99b279c, cause 'memory not mapped'
>
> Traceback:
>  1: structure(y, class = oldClass(x), row.names = attr(x, "row.names"))
>  2: `[.data.frame

Re: [Rd] include libraries for C code called from R

2006-12-12 Thread Duncan Temple Lang
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Michael.

 [There's no need to send two pieces of mail that are essentially the
same issue.]

 The problem is that when you are creating the shared object
gslTestHG.so, you are not telling the linker to combine information
from the libgsl.so or libgsl.a file.  The linker needs that to resolve
the symbols that were referenced in your RgslTest.c code.
Without this, the linker then assumes that these missing symbols will be
found when the .so is loaded, i.e. in the host application, namely R.
Compiling, linking and loading are three different steps in this
process. It helps to diagnose problems if one has an understanding
of what each does (approximately). Otherwise, the error messages
can be cryptic.

 One way to fix the problem is to create a file names Makevars in the
same directory as  RgslTest.c and add to it

  PKG_CPPFLAGS=-I/usr/include
  PKG_LIBS=-L/usr/lib -lgsl

The second of these lines tells the linker to include the symbols in
libgsl.so or libgsl.a  and that it should look for this in /usr/lib/
(You may have to change this, but it looks like that is where you have
gsl installed juding from the #include).
The -I/usr/include and -L/usr/lib  are likely to be unnecessary
but illustrate the idea that one adds library-specific include
and library directories to allow the compiler and linker
respectively find files it needs for that library's code.

And change your RgslTest.c code to have
   #include 
not the full path name to the .h file.


D.


[EMAIL PROTECTED] wrote:
> I hope that someone on this list can help me with this issue.  I have searched
> through all of the documentation and mail archives for a solution, but have
> been unable to find an answer that addresses my particular problem directly.
> 
> Suppose I am writing some C code that I want to access from R through the .C
> function.  As part of the C function, I want to include an external C library,
> such as the GNU gsl library.  So, if I want to compute the value of a Gaussian
> hypergeometric function, my C code would be:
> 
> #include 
> void gslTestHG (double *a, double *b, double *c, double *x, double *val ) {
> 
>   *val = gsl_sf_hyperg_2F1(*a,*b,*c,*x);
> }
> 
> I then compile this file (successfully, on a Linux machine with gcc installed)
> using R CMD SHLIB gslTest.c.  The message from the complier is:
> 
> gcc -I/usr/lib64/R/include -I/usr/lib64/R/include  -I/usr/local/include   
> -fpic
> -O2 -g -c RgslTest.c -o RgslTest.o
> gcc -shared -L/usr/local/lib64 -o RgslTest.so RgslTest.o -L/usr/lib64/R/lib 
> -lR
> 
> 
> When I go into R and enter the command dyn.load("gslTestHG.so"), I get the
> following error:
> 
> Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load 
> shared
> library '/mnt/san2/braunm/winshare/braunm/Cpractice/RgslTest.so':
>   /mnt/san2/braunm/winshare/braunm/Cpractice/RgslTest.so: undefined symbol:
> gsl_sf_hyperg_2F1
> 
> So, it looks like R is not recognizing the function call within my own C
> function, even though the library was included.
> 
> Note that this is a simpler example of my "real" problem, the details of which
> would bog down discussion.  I know that I could use the gsl package, or 
> include
> the Rmath.h library, to perform this particular task.  My primary need is the
> ability to call C libraries from wtihin my own C code.
> 
> But I would greatly appreciate any advice or suggestions on how to solve this
> problem.  I am a novice C programmer and Linux user, but it seems like this
> should be a simple fix.
> 
> Many thanks in advance,
> 
> Michael Braun
> MIT Sloan School of Management
> [EMAIL PROTECTED]
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

- --
Duncan Temple Lang[EMAIL PROTECTED]
Department of Statistics  work:  (530) 752-4782
4210 Mathematical Sciences Building   fax:   (530) 752-7099
One Shields Ave.
University of California at Davis
Davis,
CA 95616,
USA
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFFfyRR9p/Jzwa2QP4RAvBBAJ9nNDK4kWNt2fpCv9pw/r3XPpq6VQCfU9CL
ziDU+0OcPTEJgVV1RR/OFvA=
=oMxN
-END PGP SIGNATURE-

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


Re: [Rd] Undefined symbol when trying to dyn.load a shared object

2006-12-12 Thread Duncan Murdoch
On 12/12/2006 4:03 PM, Michael Braun wrote:
> I hope that someone reading this list can offer some suggestions on how I can 
> incorporate external C libraries in C functions that I want to call from R.  
> I have gone through all of the documentation, help files and mailing list 
> archives and have not been able to find a satisfactory solution.
> 
> I have constructed a simple example of the problem, since my "real" program 
> is much more complex and would bog down discussion.  Suppose I want to 
> compute the value of a Gaussian hypergeometric function using the function in 
> the GSL library.  My C code is:
> 
>   #include 
> 
>   void gslTestHG (double *a, double *b, double *c, double *x, double *val 
> ) {
>   *val = gsl_sf_hyperg_2F1(*a,*b,*c,*x); 
>   }
> 
> I compile this code (successfully) using R CMD SHLIB gslTest.c and get the 
> following result
> 
>   -bash-3.00$ R CMD SHLIB RgslTest.c
>   gcc -I/usr/lib64/R/include -I/usr/lib64/R/include  -I/usr/local/include 
>   -fpic  -O2 -g -c RgslTest.c -o RgslTest.o
>   gcc -shared -L/usr/local/lib64 -o RgslTest.so RgslTest.o   
> -L/usr/lib64/R/lib -lR
> 
> Next, I try to load the shared object into R using dyn.load("RgslTest.so") 
> and get the following error in R:
> 
>   > dyn.load("RgslTest.so")
>   Error in dyn.load(x, as.logical(local), as.logical(now)) : 
> unable to load shared library 
> '/mnt/san2/braunm/winshare/braunm/Cpractice/RgslTest.so':
>/mnt/san2/braunm/winshare/braunm/Cpractice/RgslTest.so: undefined 
> symbol: gsl_sf_hyperg_2F1
> 
> I am certain that the file path in the #include statement is correct.  It 
> looks like R can't find the gsl function in the C program, even though the 
> compiler did.

The #include statement just includes the headers, so that calls to the 
functions are constructed properly by the compiler.  It doesn't pull in 
the library.  That's done at link time.

You need at least a Makevars file which defines PKG_LIBS to tell the 
linker where to find the external library.  That macro should contain 
linker options -l and -L that point out the need for gsl, and where to 
find it. If you want to distribute this package to others, you'll 
probably need a configure script too, in order to construct those values.

Duncan Murdoch

> I would greatly appreciate any help you can provide.  Many thanks in advance.
> 
> Best wishes,
> 
> Michael
> 
> --
> Michael Braun
> Assistant Professor of Marketing
> MIT Sloan School of Management
> 38 Memorial Drive, E56-329
> Cambridge, MA 02139
> [EMAIL PROTECTED]
> (617) 253-3436
> 
> __
> 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] Conditional suggest

2006-12-12 Thread Seth Falcon
Kurt wrote:
>> This is not "enhancing" the way it is currently implemented, which is
>> allowing for the possibility to provide S3 or S4 methods for classes
>> from another package without actively suggesting it (thus enhancing
>> it).  

By provide an S4 method for a class, I guess you mean define a method
that includes one of the classes in its signature.  In any case, I'm
pretty sure that one must have the class definition available to
define such a method -- I think this means that to define such a
method, one must have the package defining the class loaded.  

So doesn't "enhancing" imply code like:

   if (require("Fruit"))
   setMethod("grow", "Apple", ...)

Maybe I'm missing something about how enhances is intended to work.  I
admit to being a bit oversensitive on the issue.  I find the current
warning about calls to require to be a bit overzelous.  We have a
number of packages in Bioconductor that contain functions which
attempt to load annotation data packages, for example, and these
trigger the warning.

While in general, I think it should be possible for package authors to
say "this is a package I might load if it is available, but please do
R CMD check anyway if it is not available", it doesn't even help with
packages that want to load a data package since it is not possible to
list all possible data packages ahead of time.

I don't want to start seeing spam in package code like:

   ploader <- get(paste("r", "e", "q", "u", "i", "r", "e", sep=""))
   ploader("somePkg")

just to avoid a warning message.  But warnings from R CMD check, for
our project, have substantially less value as more of them become "oh,
that is an OK warning message".

Maybe I've strayed too far off topic here.  Sorry.

+ seth

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


[Rd] Undefined symbol when trying to dyn.load a shared object

2006-12-12 Thread Michael Braun
I hope that someone reading this list can offer some suggestions on how I can 
incorporate external C libraries in C functions that I want to call from R.  I 
have gone through all of the documentation, help files and mailing list 
archives and have not been able to find a satisfactory solution.

I have constructed a simple example of the problem, since my "real" program is 
much more complex and would bog down discussion.  Suppose I want to compute the 
value of a Gaussian hypergeometric function using the function in the GSL 
library.  My C code is:

#include 

void gslTestHG (double *a, double *b, double *c, double *x, double *val 
) {
*val = gsl_sf_hyperg_2F1(*a,*b,*c,*x); 
}

I compile this code (successfully) using R CMD SHLIB gslTest.c and get the 
following result

-bash-3.00$ R CMD SHLIB RgslTest.c
gcc -I/usr/lib64/R/include -I/usr/lib64/R/include  -I/usr/local/include 
  -fpic  -O2 -g -c RgslTest.c -o RgslTest.o
gcc -shared -L/usr/local/lib64 -o RgslTest.so RgslTest.o   
-L/usr/lib64/R/lib -lR

Next, I try to load the shared object into R using dyn.load("RgslTest.so") and 
get the following error in R:

> dyn.load("RgslTest.so")
Error in dyn.load(x, as.logical(local), as.logical(now)) : 
unable to load shared library 
'/mnt/san2/braunm/winshare/braunm/Cpractice/RgslTest.so':
 /mnt/san2/braunm/winshare/braunm/Cpractice/RgslTest.so: undefined 
symbol: gsl_sf_hyperg_2F1

I am certain that the file path in the #include statement is correct.  It looks 
like R can't find the gsl function in the C program, even though the compiler 
did.

I would greatly appreciate any help you can provide.  Many thanks in advance.

Best wishes,

Michael

--
Michael Braun
Assistant Professor of Marketing
MIT Sloan School of Management
38 Memorial Drive, E56-329
Cambridge, MA 02139
[EMAIL PROTECTED]
(617) 253-3436

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


[Rd] include libraries for C code called from R

2006-12-12 Thread braunm
I hope that someone on this list can help me with this issue.  I have searched
through all of the documentation and mail archives for a solution, but have
been unable to find an answer that addresses my particular problem directly.

Suppose I am writing some C code that I want to access from R through the .C
function.  As part of the C function, I want to include an external C library,
such as the GNU gsl library.  So, if I want to compute the value of a Gaussian
hypergeometric function, my C code would be:

#include 
void gslTestHG (double *a, double *b, double *c, double *x, double *val ) {

*val = gsl_sf_hyperg_2F1(*a,*b,*c,*x);
}

I then compile this file (successfully, on a Linux machine with gcc installed)
using R CMD SHLIB gslTest.c.  The message from the complier is:

gcc -I/usr/lib64/R/include -I/usr/lib64/R/include  -I/usr/local/include   -fpic
-O2 -g -c RgslTest.c -o RgslTest.o
gcc -shared -L/usr/local/lib64 -o RgslTest.so RgslTest.o -L/usr/lib64/R/lib -lR


When I go into R and enter the command dyn.load("gslTestHG.so"), I get the
following error:

Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared
library '/mnt/san2/braunm/winshare/braunm/Cpractice/RgslTest.so':
  /mnt/san2/braunm/winshare/braunm/Cpractice/RgslTest.so: undefined symbol:
gsl_sf_hyperg_2F1

So, it looks like R is not recognizing the function call within my own C
function, even though the library was included.

Note that this is a simpler example of my "real" problem, the details of which
would bog down discussion.  I know that I could use the gsl package, or include
the Rmath.h library, to perform this particular task.  My primary need is the
ability to call C libraries from wtihin my own C code.

But I would greatly appreciate any advice or suggestions on how to solve this
problem.  I am a novice C programmer and Linux user, but it seems like this
should be a simple fix.

Many thanks in advance,

Michael Braun
MIT Sloan School of Management
[EMAIL PROTECTED]

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


[Rd] Conditional suggest (was Re: Enhances, require() and quality control)

2006-12-12 Thread Gregor Gorjanc
Kurt Hornik wrote:
>> Gregor Gorjanc writes:
...
>> I might have understood Enhances field wrongly but imagine this
>> situation. I have a package A and if I can use package B I would like to
>> use it otherwise try with "my own" solution. I thought that Enhances
>> fields is exactly for such situation. How should I check if package B is
>> available? I used
> 
>> if(require(B)) {
>>   someSuperDuperFuncFromPkgB()
>> } else {
>>   myOwnStuff()
>> }
> 
>> But R CMD check complains.
> 
>> I have encountered this with R2WinBUGS. This package helps calling
>> WinBUGS from R. It can also use OpenBUGS via BRugs, but BRugs is
>> available only for Windows. Therefore, one can not do any QC under
>> Linux. I thought to provide ability to call OpenBUGS via the same way
>> WinBUGS is called and then to put BRugs in Enhances field. But R CMD
>> check complained about use of require() for a package that is in
>> Enhanced field.
> 
> This is not "enhancing" the way it is currently implemented, which is
> allowing for the possibility to provide S3 or S4 methods for classes
> from another package without actively suggesting it (thus enhancing
> it).  What you describe seems to be a need for conditionally suggesting
> packages, e.g. if it is known that these are only available on certain
> platforms.  I don't think this is currently possible.

OK. Is there some way to test which package is being used i.e. the
"standard" or enhanced one? Or to paraphrase this differently. Are there
any proposals how "conditional suggest" could be done?

Thanks!

Gregor

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


Re: [Rd] data frame subset patch, take 2

2006-12-12 Thread Robert Gentleman
Hi,
  I tried take 1, and it failed. I have been traveling (and with 
Martin's changes also waiting for things to stabilize) before trying 
take 2, probably later this week and I will send an email if it goes in. 
Anyone wanting to try it and run R through check and check-all is 
welcome to do so and report success or failure.

  best wishes
Robert


Martin Maechler wrote:
>> "Marcus" == Marcus G Daniels <[EMAIL PROTECTED]>
>> on Tue, 12 Dec 2006 09:05:15 -0700 writes:
> 
> Marcus> Vladimir Dergachev wrote:
> >> Here is the second iteration of data frame subset patch.
> >> It now passes make check on both 2.4.0 and 2.5.0 (svn as
> >> of a few days ago).  Same speedup as before.
> >> 
> Marcus> Hi,
> 
> Marcus> I was wondering if this patch would make it into the
> Marcus> next release.  I don't see it in SVN, but it's hard
> Marcus> to be sure because the mailing list apparently
> Marcus> strips attachments.  If it isn't in, or going to be
> Marcus> in, is this patch available somewhere else?
> 
> I was wondering too.
>   http://www.r-project.org/mail.html
> explains what kind of attachments are allowed on R-devel.
> 
> I'm particularly interested, since during the last several days
> I've made (somewhat experimental) changes to R-devel,
> which makes some dealings with large data frames that have
> "trivial rownames" (those represented as  1:nrow(.))
> much more efficient.
> 
> Notably, as.matrix() of such data frames now no longer produces
> huge row names, and e.g.  dim(.) of such data frames has become
> lightning fast [compared to what it was].
> 
> Some measurements:
> 
> N <- 1e6
> set.seed(1)
> ## we round (for later dump().. reasons)
> x <- round(rnorm(N),2)
> y <- round(rnorm(N),2)
> mOrig <- cbind(x = x, y = y)
> df <- data.frame(x = x, y = y)
> mNew <- as.matrix(df)
> (sizes <- sapply(list(mOrig=mOrig, df=df, mNew=mNew), object.size))
> ## R-2.4.0 (64-bit):
> ##mOrig   df mNew
> ## 16000520 16000776 72000560
> 
> ## R-2.4.1 beta (32-bit):
> ##mOrig   df mNew
> ## 16000296 16000448 52000320
> 
> ## R-pre-2.5.0 (32-bit):
> ##mOrig   df mNew
> ## 16000296 16000448 16000296
> 
> ##
> 
> N <- 1e6
> df <- data.frame(x = 0+ 1:N, y = 1+ 1:N)
> system.time(for(i in 1:1000) d <- dim(df))
> 
> ## R-2.4.1 beta (32-bit) [deb1]:
> ## [1] 1.920 3.748 7.810 0.000 0.000
> 
> ## R-pre-2.5.0 (32-bit) [deb1]:
> ##user  system elapsed
> ##   0.012   0.000   0.011
> 
> 
> --- --- --- --- --- --- --- --- --- --- 
> 
> However, currently
> 
>   df[2,] ## still internally produces the  character(1e6)  row names!
> 
> something I think we should eliminate as well,
> i.e., at least make sure that only  seq_len(1e6) is internally
> produced and not the character vector.
> 
> Note however that some of these changes are backward
> incompatible. I do hope that the changes gaining efficiency
> for such large data frames are worth some adaption of
> current/old R source code..
> 
> Feedback on this topic is very welcome!
> 
> Martin
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 

-- 
Robert Gentleman, PhD
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
PO Box 19024
Seattle, Washington 98109-1024
206-667-7700
[EMAIL PROTECTED]

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


Re: [Rd] data frame subset patch, take 2

2006-12-12 Thread Marcus G. Daniels
Hi Martin,

Conventions for optimizing away long, useless row name vector sound very 
useful. Nice timings too!
I've noticed that before, and not been sure quite what to do.   e.g. the 
hdf5 module just gives up past a certain threshold as the long vectors 
cause performance problems and HDF5 doesn't allow giant attributes 
anyway.  The common case for me, is no row names except numbers.
> Note however that some of these changes are backward
> incompatible. I do hope that the changes gaining efficiency
> for such large data frames are worth some adaption of
> current/old R source code..
>   
On numerous occasions I've used 64 bit Altix systems, e.g. having a 
terabyte of RAM, for loading and preprocessing data, just so I can zip 
around in the image once it is done (either on that system or 
another).R works great for big datasets, even though it has a few of 
these rough edges..

Marcus

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


Re: [Rd] data frame subset patch, take 2

2006-12-12 Thread Martin Maechler
> "Marcus" == Marcus G Daniels <[EMAIL PROTECTED]>
> on Tue, 12 Dec 2006 09:05:15 -0700 writes:

Marcus> Vladimir Dergachev wrote:
>> Here is the second iteration of data frame subset patch.
>> It now passes make check on both 2.4.0 and 2.5.0 (svn as
>> of a few days ago).  Same speedup as before.
>> 
Marcus> Hi,

Marcus> I was wondering if this patch would make it into the
Marcus> next release.  I don't see it in SVN, but it's hard
Marcus> to be sure because the mailing list apparently
Marcus> strips attachments.  If it isn't in, or going to be
Marcus> in, is this patch available somewhere else?

I was wondering too.
  http://www.r-project.org/mail.html
explains what kind of attachments are allowed on R-devel.

I'm particularly interested, since during the last several days
I've made (somewhat experimental) changes to R-devel,
which makes some dealings with large data frames that have
"trivial rownames" (those represented as  1:nrow(.))
much more efficient.

Notably, as.matrix() of such data frames now no longer produces
huge row names, and e.g.  dim(.) of such data frames has become
lightning fast [compared to what it was].

Some measurements:

N <- 1e6
set.seed(1)
## we round (for later dump().. reasons)
x <- round(rnorm(N),2)
y <- round(rnorm(N),2)
mOrig <- cbind(x = x, y = y)
df <- data.frame(x = x, y = y)
mNew <- as.matrix(df)
(sizes <- sapply(list(mOrig=mOrig, df=df, mNew=mNew), object.size))
## R-2.4.0 (64-bit):
##mOrig   df mNew
## 16000520 16000776 72000560

## R-2.4.1 beta (32-bit):
##mOrig   df mNew
## 16000296 16000448 52000320

## R-pre-2.5.0 (32-bit):
##mOrig   df mNew
## 16000296 16000448 16000296

##

N <- 1e6
df <- data.frame(x = 0+ 1:N, y = 1+ 1:N)
system.time(for(i in 1:1000) d <- dim(df))

## R-2.4.1 beta (32-bit) [deb1]:
## [1] 1.920 3.748 7.810 0.000 0.000

## R-pre-2.5.0 (32-bit) [deb1]:
##user  system elapsed
##   0.012   0.000   0.011


--- --- --- --- --- --- --- --- --- --- 

However, currently

  df[2,] ## still internally produces the  character(1e6)  row names!

something I think we should eliminate as well,
i.e., at least make sure that only  seq_len(1e6) is internally
produced and not the character vector.

Note however that some of these changes are backward
incompatible. I do hope that the changes gaining efficiency
for such large data frames are worth some adaption of
current/old R source code..

Feedback on this topic is very welcome!

Martin

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


Re: [Rd] data frame subset patch, take 2

2006-12-12 Thread Marcus G. Daniels
Vladimir Dergachev wrote:
> Here is the second iteration of data frame subset patch.
> It now passes make check on both 2.4.0 and 2.5.0 (svn as of a few days ago).
> Same speedup as before.
>   
Hi,

I was wondering if this patch would make it into the next release.  I 
don't see it in SVN, but it's hard to be sure because the mailing list 
apparently strips attachments.  If it isn't in, or going to be in, is 
this patch available somewhere else?

Thanks,

Marcus

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


[Rd] Documenting revised functions

2006-12-12 Thread jhallman
I am running into some problems with the way R CMD check looks at
documentation. 

The stats::filter function returns a time series with class "ts" or
c("mts", "ts") if it is multivariate.  I have created a more capable
time series class called "tis" as part of my fame package.  My package
redefines filter() as a generic function, and has filter.default() call
the stats::filter function.  The filter.tis() function calls
filter.default() and turns the result into a tis series. 

My problem is how to document this.  Since my package exports filter(),
it needs an \alias{filter} in an Rd document, otherwise R CMD check
complains about an undocumented object.  However, when I fix that by
having an Rd document with \alias{filter} in it, help(filter) puts up
the too-small tk_select.list() menu I've complained about before to ask
me which help document I want, the package::fame one or the
package::stats one.  And because the generic filter() is now

filter <- function (x, ...) UseMethod("filter")

the filter.default() function also has to have a useless ... argument in
it to avoid this warning from R CMD check:

* checking S3 generic/method consistency ... WARNING
filter:
  function(x, ...)
filter.default:
  function(x, filter, method, sides, circular, init)

Of course, if I add the ... argument to filter.default(), I then have to
add an \item{\dots} to its help document, wherein I get to explain to
the mystified reader that the argument is ignored.

Am I missing something here?  How should I go about documenting my
generic filter() and its methods?

Jeff

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


Re: [Rd] Enhances, require() and quality control

2006-12-12 Thread Gregor Gorjanc
Kurt Hornik wrote:
>> Gregor Gorjanc writes:
> 
>> Hello!
> 
>> I am working on a package where Enhances field seems to be a plausible
>> option. When I add package, say coda, to this field, I get the
>> following warning with recent R-devel:
> 
>> 
> 
>> * checking for working latex ... OK
>> * using log directory '/home/ggorjan/programs/R/devel/test.Rcheck'
>> * using R version 2.5.0 Under development (unstable) (2006-12-06 r40129)
>> * checking for file 'test/DESCRIPTION' ... OK
>> * this is package 'test' version '0.1'
>> * checking package dependencies ... WARNING
>> 'library' or 'require' calls not declared from:
>>   coda
> 
>> See the information on DESCRIPTION files in the chapter 'Creating R
>> packages' of the 'Writing R Extensions' manual.
> 
> Why would you think that Enhances: is right here?
> 
> If you use library or require on a package, you do more than enhance it,
> and the package should be listed in Depends or Suggests.

I might have understood Enhances field wrongly but imagine this
situation. I have a package A and if I can use package B I would like to
use it otherwise try with "my own" solution. I thought that Enhances
fields is exactly for such situation. How should I check if package B is
available? I used

if(require(B)) {
  someSuperDuperFuncFromPkgB()
} else {
  myOwnStuff()
}

But R CMD check complains.

I have encountered this with R2WinBUGS. This package helps calling
WinBUGS from R. It can also use OpenBUGS via BRugs, but BRugs is
available only for Windows. Therefore, one can not do any QC under
Linux. I thought to provide ability to call OpenBUGS via the same way
WinBUGS is called and then to put BRugs in Enhances field. But R CMD
check complained about use of require() for a package that is in
Enhanced field.

Thanks!

Gregor

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