Re: [Rd] args / formals on primitives

2007-04-17 Thread Prof Brian Ripley
On Mon, 16 Apr 2007, Thomas Friedrichsmeier wrote:

> On SVN revision 41087:

which is over 100 old.

Now we are in code freeze, the pace of change should reduce considerably 
(although people will continue to work in R-devel)

> ?args has this example line:
>
> args(c)# -> NULL (c is a 'primitive' function)
>
> The comment seems out of date, as args(c) does in fact have a non-NULL return
> value:
>
> args(c)
> # function (..., recursive = FALSE)
> # NULL

That has been fixed once but the fix seems to have got lost, so I have put 
in back.

> While at it, I was wondering, why
>
> formals(c)
>
> still returns NULL, in contrast.

Because only closures have formals, the way things are defined.  This 
makes sense to me as formals<-() cannot work on primitives.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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


[Rd] no visible binding for global variable

2007-04-17 Thread Robin Hankin
Hello everyone

I am trying to get one of my packages through R's QC.

The package is clean for me under  R-2.4.1, R-2.5.0, and
R-devel,  but Kurt gets


>
> * checking R code for possible problems ... WARNING
>  hypercube: no visible binding for global variable ‘f’



Function hypercube() [cut-&-pasted below] is intended to
return an adjacency matrix for an n-dimensional
hypercube with 2^n nodes.  hypercube(n) returns a
2^n -by- 2^n matrix, and works as intended for me.

Can someone explain what the error message means?






"hypercube" <- function(n){

   jj <- as.matrix(expand.grid(rep(list(0:1),n)))

   wrapper <- function(x, y, my.fun) {
 f <- function(x,y,tol=1e-4){
   abs(sum(abs(jj[x,]-jj[y,]))-1)https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] no visible binding for global variable

2007-04-17 Thread Prof Brian Ripley
On Tue, 17 Apr 2007, Robin Hankin wrote:

> Hello everyone
>
> I am trying to get one of my packages through R's QC.
>
> The package is clean for me under  R-2.4.1, R-2.5.0, and
> R-devel,  but Kurt gets

Do you have _R_CHECK_USE_CODETOOLS_ set to something true (and for 2.4.1, 
codetools installed)?  See `Writing R Extensions'.

>> * checking R code for possible problems ... WARNING
>>  hypercube: no visible binding for global variable ?f?
>
> Function hypercube() [cut-&-pasted below] is intended to
> return an adjacency matrix for an n-dimensional
> hypercube with 2^n nodes.  hypercube(n) returns a
> 2^n -by- 2^n matrix, and works as intended for me.
>
> Can someone explain what the error message means?

If the arguments of outer() were evaluated in the frame of hypercube, 
there is no visible object 'f'.  So if 'wrapper' actually made use of its 
'my.fun' argument, this would fail.  As it is, lazy evaluation postpones 
the error (for ever).

Try removing the unused argument from wrapper(), and running the same 
test that Kurt did before and after.

BTW, it looks like updating one of your packages has broken another 
(untb).

> "hypercube" <- function(n){
>
>   jj <- as.matrix(expand.grid(rep(list(0:1),n)))
>
>   wrapper <- function(x, y, my.fun) {
> f <- function(x,y,tol=1e-4){
>   abs(sum(abs(jj[x,]-jj[y,]))-1) }
> sapply(seq(along = x), FUN = function(i){f(x[i], y[i])})
>   }
>
>   o <- -outer(1:(2^n),1:(2^n), wrapper, my.fun=f)
>   jj.names <- apply(jj,1,paste,collapse="")
>   rownames(o) <- jj.names
>   colnames(o) <- jj.names
>   diag(o) <- -apply(o,1,sum,na.rm=TRUE)
>   return(o)
> }

> --
> Robin Hankin
> Uncertainty Analyst
> National Oceanography Centre, Southampton
> European Way, Southampton SO14 3ZH, UK
>  tel  023-8059-7743


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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] save() and interrupts

2007-04-17 Thread Luke Tierney
On Mon, 16 Apr 2007, Henrik Bengtsson wrote:

> On 4/16/07, Luke Tierney <[EMAIL PROTECTED]> wrote:
>> On Mon, 16 Apr 2007, Bill Dunlap wrote:
>> 
>> > On Sun, 15 Apr 2007, Henrik Bengtsson wrote:
>> >
>> >> On 4/15/07, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
>> >>> On Sun, 15 Apr 2007, Henrik Bengtsson wrote:
>> >>>
>>  are there any (cross-platform) specs on what the saved filed is if
>>  save() is interrupted, e.g. by a user interrupt?   It could be
>>  non-existing, empty, partly written, or completed.
>> >>>
>> >>> My understanding is that you cannot user interrupt compiled code unless 
>> it
>> >>> is set up to check interrupts.  Version 2 saves are done via the 
>> internal
>> >>> saveToConn, and I don't see any calls to R_CheckUserInterrupt there. So
>> >>> you only need to worry about user interrupts in the R code, and that 
>> has
>> >>> an on.exit action to close the connection (which should be executed 
>> even
>> >>> if you interrupt).  Which suggests that the file will be
>> >>>
>> >>> non-existent
>> >>> empty
>> >>> complete
>> >>>
>> >>> and the first two depend on interrupting in the millisecond or less 
>> before
>> >>> the compiled code gets called.
>> >>
>> >> I'll put it on my todo list to investigate how to make save() more
>> >> robust against interrupts before calling the internal code.  One
>> >> option is to use tryCatch().  However, that does not handle too
>> >> frequent user interrupts, e.g. if an interrupt is sent while in the
>> >> "interrupt" call, that will interrupt the function.  So, tryCatch()
>> >> alone will only lower the risk for incomplete empty files.  For data
>> >> written to files, one alternative is to check for files of zero size
>> >> in the on.exit() statement and remove such.
>> >>
>> >> /Henrik
>> >>>
>> >>> For other forms of interrupts, e.g. a Unix kill -9, the file state 
>> could
>> >>> be anything.
>> >>>
>> >>> Brian D. Ripley,  [EMAIL PROTECTED]
>> >>> ...
>> >
>> > You could change the code to write to a temporary
>> > file (in the directory you want the result in) and
>> > when you successfully finish writing to the file
>> > you rename it to the permanent name.  (On an interrupt
>> > you remove the temp file, and on 'kill -9' the only
>> > bad effect is the space used by the partially written
>> > temp file.)  This has the added advantage that you don't
>> > overwrite an existing save file by the given name until
>> > you know a suitable replacement is ready.
>> >
>> > Perhaps we need a connection type that encapsulates this.
>> >
>> > 
>> 
>> > Bill Dunlap
>> > Insightful Corporation
>> > bill at insightful dot com
>> > 360-428-8146
>> >
>> > "All statements in this message represent the opinions of the author and 
>> do
>> > not necessarily reflect Insightful Corporation policy or position."
>> 
>> We do this with save.image.  Since save is a little more general it is
>> a bit less obvious what the right way to do this sort of thing is, or
>> whether there is a single right way.  I think if I was concerned about
>> this I would write something around the current save for particular
>> kinds of connections rather than changing save itself.  The main
>> reason for taking a different rout with save.image is that that gets
>> called implicitly by q().
>> 
>> [our current ability to manage user interrupts is not ideal--hopefully
>> we can make a bit of progress on this soon.]
>
> I was thinking about this last night:  It would be useful to have a
> feature/construct to evaluate an R expression atomically where user
> interrupts will *not have an affect until afterwards*, cf. calls to
> native code.  This would solve the problem of getting interrupts while
> in a tryCatch(..., interrupt=..., finally=...).  Of course this
> requires caution by the programmer, but it is also unlikely to be used
> by someone who do not know what the risks are.  I do not know the
> different signals available, but one could consider such atomic calls
> to be protected against different levels of signals.  In addition, one
> could have an optional threshold of the number of interrupt signals it
> takes to (even) interrupt an atomic evaluation.

This is the sort of thing I have been tinking about. One also needs to
enable interrupts within selected parts of such a construct, and these
things need to cooperate with each other and with internal code. There
is a paper on doing these sorts of things in a principled way in
Haskell that I want to spend some time reading to see what translates
to us.

Best,

luke

-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
Actuarial Science
241 Schaeffer Hall  email:  [EMAIL PROTECTED]
Iowa City, IA 52242

[Rd] predict.ar() produces wrong SE's (PR#9614)

2007-04-17 Thread kirk . hampel
Full_Name: Kirk Hampel
Version: 2.4.1
OS: Windows
Submission from: (NULL) (144.53.251.2)


Given an AR(p) model, the last p SE's are wrong.

The source of the bug is that the C code (ver 2.4.0) assumes *npsi is the length
of the psi vector (which is n+p), whilst the predict.ar function in R passes out
as.integer(npsi), where npsi <- n-1.

Some R code following reproduces the error. Let p=4, n=6, then

> ar<-c(-0.5,0.25,-0.125,0.0625)
> Mod(polyroot(c(1,-ar))) # ar model is stationary
[1] 1.037580 2.444163 2.444163 2.581298
> #Pass in values as predict.ar does
> cumsum(c(1,.C("artoma",as.integer(4),as.double(ar),double(9),as.integer(5))[[3]][1:5]^2))
[1] 1.00 1.25 1.312500 1.328125 1.332031 1.332031
> #Pass in value that C code expects
> cumsum(c(1,.C("artoma",as.integer(4),as.double(ar),double(9),as.integer(9))[[3]][1:5]^2))
[1] 1.00 1.25 1.50 1.75 2.00 2.219727

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


[Rd] [Wishlist] to uniform help(x) and library(help=x) behaviours relating "htmlhelp" option (PR#9613)

2007-04-17 Thread lbraglia
Full_Name: Luca Braglia
Version: R version 2.4.1 (2006-12-18)
OS: Debian Lenny (testing)
Submission from: (NULL) (82.61.142.240)


Some options of mine:

> options("htmlhelp")
$htmlhelp
[1] TRUE

> options("browser")
$browser
[1] "/usr/bin/urxvt -rv -e elinks"


I run R under X windows system: if I command

help(foo)

foo manual page is printed, correctly, under elinks (my textual browser); but if
I command 

library(help=asd)

asd package summary page is printed in R console.
I would like library(help=asd) to be printed in my browser too, if possible:
strictly speaking

--> add htmlhelp = getOption("htmlhelp") in library arguments

to be used only if "help" option  is specified.


Thanks a lot,

 Luca







Version:
 platform = i486-pc-linux-gnu
 arch = i486
 os = linux-gnu
 system = i486, linux-gnu
 status =
 major = 2
 minor = 4.1
 year = 2006
 month = 12
 day = 18
 svn rev = 40228
 language = R
 version.string = R version 2.4.1 (2006-12-18)


locale:
LC_CTYPE=it_IT.UTF-8;LC_NUMERIC=C;LC_TIME=it_IT.UTF-8;LC_COLLATE=it_IT.UTF-8;LC_MONETARY=it_IT.UTF-8;LC_MESSAGES=it_IT.UTF-8;LC_PAPER=it_IT.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=it_IT.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] "utils" "stats" "graphics"  "grDevices" "methods"  
[6] "base" 

other attached packages:
MASS 
"7.2-33" 


Search Path:
 .GlobalEnv, package:MASS, package:utils, package:stats, package:graphics,
pack\
age:grDevices, package:methods, Autoloads, package:base

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


[Rd] rhel5 rpm spec mods

2007-04-17 Thread Ben Walton
Hi All,

I'm in the process of building an rpm for rhel5 (client currently).
This has required modification of the spec file.  When I've completed
the process, I'd like to submit the changes to save others doing the
same work.  Is this the appropriate place to submit a patch with those
changes?

Thanks
-Ben
-- 
Ben Walton
Systems Programmer
Office of Planning & IT
Faculty of Arts & Science
University of Toronto
Cell: 416.407.5610

GPG Key Id: 8E89F6D2; Keyserver: pgp.mit.edu
Contact me to arrange for a CAcert assurance meeting.

Please Note: This e-mail is intended only for the use of the individual or
entity to which it is addressed.  It may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
Any dissemination, disclosure, printing, publishing or use of this email
or the information contained herein without written authorization of the
sender is strictly prohibited.  If you have received this e-mail in
error, please notify the sender immediately and delete. Thank you.


pgp5DMLHuTYEs.pgp
Description: PGP signature
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] rhel5 rpm spec mods

2007-04-17 Thread Hin-Tak Leung
Ben Walton wrote:
> Hi All,
> 
> I'm in the process of building an rpm for rhel5 (client currently).
> This has required modification of the spec file.  When I've completed
> the process, I'd like to submit the changes to save others doing the
> same work.  Is this the appropriate place to submit a patch with those
> changes?
> 
> Thanks
> -Ben

I'll be interested to see it, but I wonder what kind of modification is
*required*? I am currently using a spec file modified from the 2.3 era
for 2.4 onto fedora 6, and I don't think there is *any* required
change to make the old spec file works on fc6.

Here are a list of my changes (from a diff I just do):
(1) ver 2.3.1<->2.4.1, plus a custom release tag to distinguish
from official build
(2) a bunch of change to do with LDFLAGS, etc so that I can do 32-bit 
build on 64-bit platforms.
(3) enable memory profiling and strict type check
(4) make also the pdf's for the full reference manual and the
extension manual.

These are all personal preferences; and FWIW, fedora extra also carries 
R (and I believe RHEL5 can get at fedora extra's via yum), so
(1) are you refering to the spec file on cran or the spec file on fedora 
extra? They are quite different!
(2) are you sure your "required" modification not a matter of personal 
preference as well?

HTL

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


Re: [Rd] rhel5 rpm spec mods

2007-04-17 Thread Ben Walton
The only changes I've made (taken from the fc6.src.rpm) are in the
initial detection of which linux/rpm-based distro it's being built on.
This allows detection of gcc version, pdfviewer, etc.  These changes are
all similar to what happens in the fc line of detection, but weren't
being done for rhel.

Without modification, rpmbuild was looking for XFree86-devel and gcc-g77
which aren't valid packages in rhel5 (haven't looked at 4 as rpms were
already built for that).

I am aware of fedora extras but haven't gotten to the point of using
them in rhel (we do in our fc installs).  Personally, I'd prefer to stay
away from the fc rpm trees when possible as (being a devel distro)
versions can change wildly and bugs are more likely to crop up in
packaging, etc (we've been bitten in the past).  I'm moving away from fc
for production machines for this reason.  I prefer fewer surprises in
production machines when possible.

I'll discuss the required(1) changes with Martyn and submit them if he's
agreeable.

Thanks
-Ben

(1) assuming that they are required and I'm not missing the obvious.
-- 
Ben Walton
Systems Programmer
Office of Planning & IT
Faculty of Arts & Science
University of Toronto
Cell: 416.407.5610

GPG Key Id: 8E89F6D2; Keyserver: pgp.mit.edu
Contact me to arrange for a CAcert assurance meeting.

Please Note: This e-mail is intended only for the use of the individual or
entity to which it is addressed.  It may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
Any dissemination, disclosure, printing, publishing or use of this email
or the information contained herein without written authorization of the
sender is strictly prohibited.  If you have received this e-mail in
error, please notify the sender immediately and delete. Thank you.


pgp6pJUKiAF52.pgp
Description: PGP signature
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] rhel5 rpm spec mods

2007-04-17 Thread Hin-Tak Leung
Ben Walton wrote:
> The only changes I've made (taken from the fc6.src.rpm) are in the
> initial detection of which linux/rpm-based distro it's being built on.
> This allows detection of gcc version, pdfviewer, etc.  These changes are
> all similar to what happens in the fc line of detection, but weren't
> being done for rhel.

Yes, those sounds reasonable.

> Without modification, rpmbuild was looking for XFree86-devel and gcc-g77
> which aren't valid packages in rhel5 (haven't looked at 4 as rpms were
> already built for that).

yes and no. You can do "rpmbuild --nodeps " without
modifying the spec file to tell rpmbuild to go ahead, I think.
This is also often the technique used when one tries to
build rpm's on non-rpm based systems like debian/gentoo/slackware.

> I am aware of fedora extras but haven't gotten to the point of using
> them in rhel (we do in our fc installs).  Personally, I'd prefer to stay
> away from the fc rpm trees when possible as (being a devel distro)
> versions can change wildly and bugs are more likely to crop up in
> packaging, etc (we've been bitten in the past).  I'm moving away from fc
> for production machines for this reason.  I prefer fewer surprises in
> production machines when possible.

Personally, I think EL4 is too old/conservative (and I don't have access
to EL5), and it makes me angry when I encounter a bug or limitation
that I know was already fixed/addressed a year or two ago. Can't win.
:-).

HTL

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


Re: [Rd] rhel5 rpm spec mods

2007-04-17 Thread Ben Walton
On Tue, Apr 17, 2007 at 05:29:31PM +0100, Hin-Tak Leung wrote:
+>  >Without modification, rpmbuild was looking for XFree86-devel and gcc-g77
+>  >which aren't valid packages in rhel5 (haven't looked at 4 as rpms were
+>  >already built for that).
+>  
+>  yes and no. You can do "rpmbuild --nodeps " without
+>  modifying the spec file to tell rpmbuild to go ahead, I think.
+>  This is also often the technique used when one tries to
+>  build rpm's on non-rpm based systems like debian/gentoo/slackware.

That would work, but shouldn't be required, imho.  I sent the patch to
Martyn already, so hopefully it gets included.

+>  >I am aware of fedora extras but haven't gotten to the point of using
+>  >them in rhel (we do in our fc installs).  Personally, I'd prefer to stay
+>  >away from the fc rpm trees when possible as (being a devel distro)
+>  >versions can change wildly and bugs are more likely to crop up in
+>  >packaging, etc (we've been bitten in the past).  I'm moving away from fc
+>  >for production machines for this reason.  I prefer fewer surprises in
+>  >production machines when possible.
+>  
+>  Personally, I think EL4 is too old/conservative (and I don't have access
+>  to EL5), and it makes me angry when I encounter a bug or limitation
+>  that I know was already fixed/addressed a year or two ago. Can't win.
+>  :-).

Yes, EL4 is old and conservative.  EL5 will be the same in short order.
They are also stable and (mostly) surprise free.  I have encountered
bugs that are frustrating due to their age (open nfs locks and crashing
apps springs to mind) but for the most part I like it for my servers
(and lab machines/workstations, etc).  FC has it's (very important)
place and I do suggest that home users work with it (or Ubuntu/Debian).
The other issue with FC in production is the legacy support one.  I
can't be bothered to upgrade machines as often as the fc support cycle
would have me do (I miss fedoralegacy.org already).  I'm not really
saying I personally prefer RedHat, but it does meet a very important
need for me.

Thanks
-Ben
-- 
Ben Walton
Systems Programmer
Office of Planning & IT
Faculty of Arts & Science
University of Toronto
Cell: 416.407.5610

GPG Key Id: 8E89F6D2; Keyserver: pgp.mit.edu
Contact me to arrange for a CAcert assurance meeting.

Please Note: This e-mail is intended only for the use of the individual or
entity to which it is addressed.  It may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
Any dissemination, disclosure, printing, publishing or use of this email
or the information contained herein without written authorization of the
sender is strictly prohibited.  If you have received this e-mail in
error, please notify the sender immediately and delete. Thank you.


pgpsT4IJmHUfA.pgp
Description: PGP signature
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] predict.ar() produces wrong SE's (PR#9614)

2007-04-17 Thread ripley
Thank you.  Here is a reproducible example (since yours is not of the 
actual code):

example(ar)
predict(sunspot.ar, n.ahead=25)
predict(sunspot.ar, n.ahead=20)

and compare, say, prediction 20.

Fixed for 2.5.0.

On Tue, 17 Apr 2007, [EMAIL PROTECTED] wrote:

> Full_Name: Kirk Hampel
> Version: 2.4.1
> OS: Windows
> Submission from: (NULL) (144.53.251.2)
>
>
> Given an AR(p) model, the last p SE's are wrong.
>
> The source of the bug is that the C code (ver 2.4.0) assumes *npsi is the 
> length
> of the psi vector (which is n+p), whilst the predict.ar function in R passes 
> out
> as.integer(npsi), where npsi <- n-1.
>
> Some R code following reproduces the error. Let p=4, n=6, then
>
>> ar<-c(-0.5,0.25,-0.125,0.0625)
>> Mod(polyroot(c(1,-ar))) # ar model is stationary
> [1] 1.037580 2.444163 2.444163 2.581298
>> #Pass in values as predict.ar does
>> cumsum(c(1,.C("artoma",as.integer(4),as.double(ar),double(9),as.integer(5))[[3]][1:5]^2))
> [1] 1.00 1.25 1.312500 1.328125 1.332031 1.332031
>> #Pass in value that C code expects
>> cumsum(c(1,.C("artoma",as.integer(4),as.double(ar),double(9),as.integer(9))[[3]][1:5]^2))
> [1] 1.00 1.25 1.50 1.75 2.00 2.219727
>
> __
> 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:  +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] rhel5 rpm spec mods

2007-04-17 Thread Peter Dalgaard
Ben Walton wrote:
> Hi All,
>
> I'm in the process of building an rpm for rhel5 (client currently).
> This has required modification of the spec file.  When I've completed
> the process, I'd like to submit the changes to save others doing the
> same work.  Is this the appropriate place to submit a patch with those
> changes?
>   
Probably, contacting Martyn Plummer directly is the way to go.

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


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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


[Rd] typo in R-exts

2007-04-17 Thread Tony Plate
There looks to be a typo in the R-exts manual:

The whose @file{tests} is copied to the check area, ...
 ^

I'm not sure what was intended here, so I can't suggest a fix.

(from https://svn.r-project.org/R/trunk/doc/manual/R-exts.texi)

-- Tony Plate

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


Re: [Rd] rhel5 rpm spec mods

2007-04-17 Thread Prof Brian Ripley
On Tue, 17 Apr 2007, Ben Walton wrote:

> Hi All,
>
> I'm in the process of building an rpm for rhel5 (client currently).
> This has required modification of the spec file.  When I've completed
> the process, I'd like to submit the changes to save others doing the
> same work.  Is this the appropriate place to submit a patch with those
> changes?

http://cran.r-project.org/bin/linux/redhat/SRPMS/R.spec

names the principal author, Martyn Plummer. Please contact him.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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


[Rd] use of .Rout.save files in the 'tests' directory of a package

2007-04-17 Thread Tony Plate
Even though all files in the 'tests' directory are copied to the 
installation directory and tests are run there, the current makefiles 
that runs the tests (share/make/{tests,wintests}.mk seem to go to some 
trouble to refer to the .Rout.save files in the original 'tests' 
directory. (E.g., in the line "@if test -f $(srcdir)/[EMAIL PROTECTED]; then" 
in 
share/make/tests.mk.)  This means that .Rout.save files created during 
the testing process (either by .Rin files or via 'make') are not seen. 
I'm using R-2.5.0 (beta) under Windows and Linux, and AFAICT, this is 
the same under both systems.

Is there some good reason that .Rout.save files from the source 'tests' 
directory are used rather than the ones in the fresh copy of the 'tests' 
directory?  If this is some sort of historical legacy, could this be 
changed so that the testing always uses the copies of the files in fresh 
copy of the 'tests' directory?  (In cases where they are present in the 
source directory, they should be identical, AFAICS.)

-- Tony Plate

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


Re: [Rd] typo in R-exts

2007-04-17 Thread Peter Dalgaard
Tony Plate wrote:
> There looks to be a typo in the R-exts manual:
>
> The whose @file{tests} is copied to the check area, ...
>  ^
>
> I'm not sure what was intended here, so I can't suggest a fix.
>   
'svn blame' tells me that this was Brian's addition in rev.35362. There 
is no previous version to help with guessing the intention. One 
possibility is that "The whose" should be "The directory", or maybe "The 
whole directory".
> (from https://svn.r-project.org/R/trunk/doc/manual/R-exts.texi)
>
> -- Tony Plate
>
> __
> 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] typo in R-exts

2007-04-17 Thread Tony Plate
The actual behavior, as far as I can make out, is that all the files in 
the 'tests' directory are copied, but not any subdirectories (which I 
personally would have found useful).

So, saying the "whole directory" is probably not accurate.

-- Tony Plate

Peter Dalgaard wrote:
> Tony Plate wrote:
>> There looks to be a typo in the R-exts manual:
>>
>> The whose @file{tests} is copied to the check area, ...
>>  ^
>>
>> I'm not sure what was intended here, so I can't suggest a fix.
>>   
> 'svn blame' tells me that this was Brian's addition in rev.35362. There 
> is no previous version to help with guessing the intention. One 
> possibility is that "The whose" should be "The directory", or maybe "The 
> whole directory".
>> (from https://svn.r-project.org/R/trunk/doc/manual/R-exts.texi)
>>
>> -- Tony Plate
>>
>> __
>> 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] typo in R-exts

2007-04-17 Thread Prof Brian Ripley
'whole of', as svn up will show you.

I prefer 'svn praise' myself.

BTW, it is very easy to read @file{foo} as 'file foo', and that is a 
frequent problem.

On Tue, 17 Apr 2007, Peter Dalgaard wrote:

> Tony Plate wrote:
>> There looks to be a typo in the R-exts manual:
>>
>> The whose @file{tests} is copied to the check area, ...
>>  ^
>>
>> I'm not sure what was intended here, so I can't suggest a fix.
>>
> 'svn blame' tells me that this was Brian's addition in rev.35362. There
> is no previous version to help with guessing the intention. One
> possibility is that "The whose" should be "The directory", or maybe "The
> whole directory".
>> (from https://svn.r-project.org/R/trunk/doc/manual/R-exts.texi)
>>
>> -- Tony Plate
>>
>> __
>> 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
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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] typo in R-exts

2007-04-17 Thread Peter Dalgaard
Prof Brian Ripley wrote:
>
> I prefer 'svn praise' myself.
Or 'svn annotate'.

I think it depends on what I'm looking for, plus the risk that the 
author (perpetrator, contributor) might be me

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


[Rd] sys.call and friends

2007-04-17 Thread Jeffrey Horner

Hello,


I noticed that sys.frame treats which = 0 differently than sys.call and 
sys.function, and the documentation was unclear about it.


> f <- function() sys.call()
> f()
f()
> f <- function() sys.function()
> f()
function() sys.function()
> f <- function() sys.frame()
> f()


sys.frame(0) always returns the .GlobalEnv, while sys.call(0) and 
sys.function(0) return the current call and function definition.


I offer a patch to clarify this for the uninitiated.

> sessionInfo()
R version 2.6.0 Under development (unstable) (2007-04-16 r41194)
i686-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"
[7] "base"

Jeff
--
http://biostat.mc.vanderbilt.edu/JeffreyHorner
Index: src/library/base/man/sys.parent.Rd
===
--- src/library/base/man/sys.parent.Rd	(revision 41208)
+++ src/library/base/man/sys.parent.Rd	(working copy)
@@ -18,9 +18,9 @@
 }
 \usage{
 sys.call(which = 0)
+sys.function(which = 0)
 sys.frame(which = 0)
 sys.nframe()
-sys.function(which = 0)
 sys.parent(n = 1)
 
 sys.calls()
@@ -32,7 +32,7 @@
 }
 \arguments{
   \item{which}{the frame number if non-negative, the number of frames
-to go back if negative.}
+to go back if negative.(See the Details section on how 0 is handled.)}
   \item{n}{the number of generations to go back. (See the Details section.)}
 }
 \details{
@@ -42,11 +42,20 @@
   of that function are returned by \code{sys.call}, \code{sys.function}
   and \code{sys.frame} with the appropriate index.
 
-  \code{sys.call}, \code{sys.frame} and \code{sys.function} accept
+  \code{sys.call}, \code{sys.function} and \code{sys.frame} accept
   integer values for the argument \code{which}.  Non-negative values of
   \code{which} are frame numbers whereas negative values are
-  counted back from the frame number of the current evaluation.
+  counted back from the frame number of the current evaluation. 
 
+  When \code{which} is 0 (the default value), \code{sys.call} and \code{sys.function}
+  return the call and function definition of the current frame, while \code{sys.frame}
+  returns the \code{\link{.GlobalEnv}}.
+
+  \code{sys.nframe} returns an integer, the number of the current frame
+  as described in the first paragraph. Consequently, \code{sys.call()} and
+  \code{sys.function()} are equivalent to \code{sys.call(sys.nframe())}
+  and \code{sys.function(sys.nframe())}.
+
   The parent frame of a function evaluation is the environment in which
   the function was called.  It is not necessarily numbered one less than
   the frame number of the current evaluation, nor is it the environment
@@ -54,9 +63,6 @@
   number of the parent frame if \code{n} is 1 (the default), the
   grandparent if \code{n} is 2, and so on.
 
-  \code{sys.nframe} returns an integer, the number of the current frame
-  as described in the first paragraph.
-
   \code{sys.calls} and \code{sys.frames} give a pairlist of all the
   active calls and frames, respectively, and \code{sys.parents} returns
   an integer vector of indices of the parent frames of each of those
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Documentation update to R-lang.texi

2007-04-17 Thread Duncan Murdoch
On 4/16/2007 12:57 PM, Jeffrey Horner wrote:
> Section 4.3.4 of R-lang.texi version 41191 in the paragraph that starts 
> "When h(3) is..." explains that x and y are unbound variables in the 
> function body of g in this example:
> 
>   f <- function(x) {
>   y <- 10
>   g <- function(x) x + y
>   return(g)
>   }
>   h <- f()
>   h(3)
> 
> while the paragraph following the example explains that "bound variables 
> are those that match the formal arguments to the function." So wouldn't 
> x be bound?

I'll fix this in R-devel and the beta.

Duncan Murdoch

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


[Rd] undefined symbol: Rf_rownamesgets

2007-04-17 Thread Ross Boylan
I get the error
 undefined symbol: Rf_rownamesgets
when I try to load my package, which include C++ code that calls that
function.  This is particularly strange since the code also calls
Rf_classgets, and it loaded OK with just that.

Can anyone tell me what's going on?  

For the record, I worked around this with the general purpose
attribute setting commands and R_RowNamesSymbol.  I discovered that
even with that I wasn't constructing a valid data.frame, and fell back
to returning a list of results.

I notice Rinternals.h defines
LibExtern SEXP  R_RowNamesSymbol;   /* "row.names" */
twice in the same block of code.

I'm using R 2.4.1 on Debian. The symbol seems to be there:
$ nm -D /usr/lib/R/lib/libR.so | grep classgets
00032e70 T Rf_classgets
$ nm -D /usr/lib/R/lib/libR.so | grep namesgets
00031370 T Rf_dimnamesgets
00034500 T Rf_namesgets

The source includes
#define R_NO_REMAP 1
#include 
#include 
and later
#include   // I think this is why I needed R_NO_REMAP

I realize this is not a complete example, but I'm hoping this will
ring a bell with someone.  I encountered this while running
R CMD check.  The link line generated was
g++ -shared  -o mspath.so AbstractTimeStepsGenerator.o Coefficients.o 
CompositeHistoryComputer.o CompressedTimeStepsGenerator.o Covariates.o Data.o 
Environment.o Evaluator.o FixedTimeStepsGenerator.o LinearProduct.o Manager.o 
Model.o ModelBuilder.o Path.o PathGenerator.o PrimitiveHistoryComputer.o 
SimpleRecorder.o Specification.o StateTimeClassifier.o SuccessorGenerator.o 
TimePoint.o TimeStepsGenerator.o mspath.o mspathR.o   -L/usr/lib/R/lib -lR

Thanks.
Ross

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


[Rd] Performing Merge and Duplicated on very large files

2007-04-17 Thread Eitan Rubin
Hi,

  I am working with very large matrices (>1 million records), and need to
1. Join the files (can be achieved with Merge)
2. Find lines that have the same value in some field (after the join) and
randomly sample 1 row.

I am concerned with the complexity of merge - how (un)efficient is it? I
don't have access to the real data, I need to send the script to someone who
does, so I can't just try and see what happens.

Similarly I am worried about the duplicated function - will it run on the
merged matrix? It is expected to be ~500,000 rows long, and have small
clusters of duplicated values (1-10 repeats of the same value).

  ER
 - - - - - -
Eitan Rubin
Dept. of Microbiology and Immunology
AND
National Institute of Biotechnology in the Negev

Ben Gurion University
Beer Sheva, Israel
Phone: 08-6479197

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


Re: [Rd] undefined symbol: Rf_rownamesgets

2007-04-17 Thread Duncan Murdoch
On 4/17/2007 10:43 PM, Ross Boylan wrote:
> I get the error
>  undefined symbol: Rf_rownamesgets
> when I try to load my package, which include C++ code that calls that
> function.  This is particularly strange since the code also calls
> Rf_classgets, and it loaded OK with just that.
> 
> Can anyone tell me what's going on?  
> 
> For the record, I worked around this with the general purpose
> attribute setting commands and R_RowNamesSymbol.  I discovered that
> even with that I wasn't constructing a valid data.frame, and fell back
> to returning a list of results.
> 
> I notice Rinternals.h defines
> LibExtern SEXPR_RowNamesSymbol;   /* "row.names" */
> twice in the same block of code.
> 
> I'm using R 2.4.1 on Debian. The symbol seems to be there:
> $ nm -D /usr/lib/R/lib/libR.so | grep classgets
> 00032e70 T Rf_classgets
> $ nm -D /usr/lib/R/lib/libR.so | grep namesgets
> 00031370 T Rf_dimnamesgets
> 00034500 T Rf_namesgets

I don't see Rf_rownamesgets there, or in the R Externals manual among 
the API entry points listed.  Can't you use the documented dimnamesgets?

Duncan Murdoch

> The source includes
> #define R_NO_REMAP 1
> #include 
> #include 
> and later
> #include   // I think this is why I needed R_NO_REMAP
> 
> I realize this is not a complete example, but I'm hoping this will
> ring a bell with someone.  I encountered this while running
> R CMD check.  The link line generated was
> g++ -shared  -o mspath.so AbstractTimeStepsGenerator.o Coefficients.o 
> CompositeHistoryComputer.o CompressedTimeStepsGenerator.o Covariates.o Data.o 
> Environment.o Evaluator.o FixedTimeStepsGenerator.o LinearProduct.o Manager.o 
> Model.o ModelBuilder.o Path.o PathGenerator.o PrimitiveHistoryComputer.o 
> SimpleRecorder.o Specification.o StateTimeClassifier.o SuccessorGenerator.o 
> TimePoint.o TimeStepsGenerator.o mspath.o mspathR.o   -L/usr/lib/R/lib -lR
> 
> Thanks.
> Ross
> 
> __
> 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] undefined symbol: Rf_rownamesgets

2007-04-17 Thread Ross Boylan
On Tue, Apr 17, 2007 at 11:07:12PM -0400, Duncan Murdoch wrote:
> On 4/17/2007 10:43 PM, Ross Boylan wrote:
> >I get the error
> > undefined symbol: Rf_rownamesgets
> >when I try to load my package, which include C++ code that calls that
> >function.  This is particularly strange since the code also calls
> >Rf_classgets, and it loaded OK with just that.
> >
> >Can anyone tell me what's going on?  
> >
> >For the record, I worked around this with the general purpose
> >attribute setting commands and R_RowNamesSymbol.  I discovered that
> >even with that I wasn't constructing a valid data.frame, and fell back
> >to returning a list of results.
> >
> >I notice Rinternals.h defines
> >LibExtern SEXP   R_RowNamesSymbol;   /* "row.names" */
> >twice in the same block of code.
> >
> >I'm using R 2.4.1 on Debian. The symbol seems to be there:
> >$ nm -D /usr/lib/R/lib/libR.so | grep classgets
> >00032e70 T Rf_classgets
> >$ nm -D /usr/lib/R/lib/libR.so | grep namesgets
> >00031370 T Rf_dimnamesgets
> >00034500 T Rf_namesgets
> 
> I don't see Rf_rownamesgets there, or in the R Externals manual among 
> the API entry points listed.  
You're right; sorry.  So does this function just not exist?  If so,
it would be good to remove the corresponding entries in Rinternals.h.

>Can't you use the documented dimnamesgets?
I did one better and didn't use anything!  I thought presence in
Rinternals.h constituted (terse) documentation, since the R Externals
manual says ("Handling R objects in C")
---
   There are two approaches that can be taken to handling R objects from
within C code.  The first (historically) is to use the macros and
functions that have been used to implement the core parts of R through
`.Internal' calls.  A public subset of these is defined in the header
file `Rinternals.h' ...
-

So is relying on Rinternals.h a bad idea?

In this case, accessing the row names through dimnamesgets looks a
little awkward, since it requires navigating to the right spot in
dimnames.  I would need Rf_dimnamesgets since I disabled the shortcut
names.

Ross

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


Re: [Rd] undefined symbol: Rf_rownamesgets

2007-04-17 Thread Prof Brian Ripley
On Tue, 17 Apr 2007, Duncan Murdoch wrote:

> On 4/17/2007 10:43 PM, Ross Boylan wrote:
>> I get the error
>>  undefined symbol: Rf_rownamesgets
>> when I try to load my package, which include C++ code that calls that
>> function.  This is particularly strange since the code also calls
>> Rf_classgets, and it loaded OK with just that.
>>
>> Can anyone tell me what's going on?
>>
>> For the record, I worked around this with the general purpose
>> attribute setting commands and R_RowNamesSymbol.  I discovered that
>> even with that I wasn't constructing a valid data.frame, and fell back
>> to returning a list of results.
>>
>> I notice Rinternals.h defines
>> LibExtern SEXP   R_RowNamesSymbol;   /* "row.names" */
>> twice in the same block of code.
>>
>> I'm using R 2.4.1 on Debian. The symbol seems to be there:
>> $ nm -D /usr/lib/R/lib/libR.so | grep classgets
>> 00032e70 T Rf_classgets
>> $ nm -D /usr/lib/R/lib/libR.so | grep namesgets
>> 00031370 T Rf_dimnamesgets
>> 00034500 T Rf_namesgets
>
> I don't see Rf_rownamesgets there, or in the R Externals manual among
> the API entry points listed.  Can't you use the documented dimnamesgets?

dimnamesgets is for arrays not data frames.  There is no 'rownamesgets' in 
the current sources, but a static row_names_gets that is called by 
setAttrib.

>
> Duncan Murdoch
>
>> The source includes
>> #define R_NO_REMAP 1
>> #include 
>> #include 
>> and later
>> #include   // I think this is why I needed R_NO_REMAP
>>
>> I realize this is not a complete example, but I'm hoping this will
>> ring a bell with someone.  I encountered this while running
>> R CMD check.  The link line generated was
>> g++ -shared  -o mspath.so AbstractTimeStepsGenerator.o Coefficients.o 
>> CompositeHistoryComputer.o CompressedTimeStepsGenerator.o Covariates.o 
>> Data.o Environment.o Evaluator.o FixedTimeStepsGenerator.o LinearProduct.o 
>> Manager.o Model.o ModelBuilder.o Path.o PathGenerator.o 
>> PrimitiveHistoryComputer.o SimpleRecorder.o Specification.o 
>> StateTimeClassifier.o SuccessorGenerator.o TimePoint.o TimeStepsGenerator.o 
>> mspath.o mspathR.o   -L/usr/lib/R/lib -lR
>>
>> Thanks.
>> Ross
>>
>> __
>> 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
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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