Re: [Rd] R 2.5.0 devel try issue in conjuntion with S4 method dispatch

2007-03-16 Thread Martin Maechler
> "PD" == Peter Dalgaard <[EMAIL PROTECTED]> > on Fri, 16 Mar 2007 08:09:00 +0100 writes: PD> Seth Falcon wrote: >> [EMAIL PROTECTED] writes: >> >>> Investigating this new implementation I come across an issue in >>> conjuntion with using S4 classes and methods. t

[Rd] Unhidden predict methods

2007-03-16 Thread Henric Nilsson (Public)
Hi, I've noted that not all `predict' methods are hidden in the namespace: > methods("predict") [1] predict.ar*predict.Arima* [3] predict.arima0*predict.glm [5] predict.HoltWinters* predict.lm [7] predict.loess* predict.mlm [9] predict.nls*

Re: [Rd] Unhidden predict methods

2007-03-16 Thread Henrik Bengtsson
One reason is that you should never call those methods directly but only via the generic function predict(), and this is a way to prevent such misuse/mishaps. You can always use getAnywhere() if you want look at the code. /H On 3/16/07, Henric Nilsson (Public) <[EMAIL PROTECTED]> wrote: > Hi, >

Re: [Rd] Unhidden predict methods

2007-03-16 Thread Prof Brian Ripley
The reason some are not hidden is historical: they were called explicitly by (contributed) package code at the time namespaces were introduced. It would be a good idea to revisit some of those decisions, but it is not a very appealing way to spend one's time. On Fri, 16 Mar 2007, Henric Nilsson

Re: [Rd] allocVector reference

2007-03-16 Thread Prof Brian Ripley
I believe your assertions are incorrect about both '=' and when copying is done. '=' is neither old nor deprecated and is syntactically different from '<-', but where it means assignment, it invokes the same internal code as '<-'. R maintains a call-by-value illusion, but it does not actually

Re: [Rd] Unhidden predict methods

2007-03-16 Thread Henric Nilsson (Public)
Den 2007-03-16 13:25, Prof Brian Ripley skrev: > The reason some are not hidden is historical: they were called > explicitly by (contributed) package code at the time namespaces were > introduced. Ah, I see. In that case I'll just hide away as much as possible in the new package I'm working o

Re: [Rd] Unhidden predict methods

2007-03-16 Thread Gabor Grothendieck
Sometimes its useful to call a method on a class other than the method indicated by the suffix of the method name and in that case one needs to call the method directly rather than via the generic. For an example, see: http://tolstoy.newcastle.edu.au/R/e2/help/07/01/9383.html On 3/16/07, Henric

Re: [Rd] R 2.5.0 devel try issue in conjuntion with S4 method dispatch

2007-03-16 Thread Seth Falcon
This is off-topic, but since the discussion moved towards coding style... Here are some comments on S4 style. [EMAIL PROTECTED] writes: > ## using S4 classes and methods > setClass("fooBase", > representation("VIRTUAL", > width = "numeric", >

Re: [Rd] Inherited S4 methods

2007-03-16 Thread Seth Falcon
cstrato <[EMAIL PROTECTED]> writes: > I have a variation of this question: > Is it possible to use the same function name, e.g. "myfunction" in both, > an S4 > baseClass and derivedClass. The method "myfunction" in derivedCalss should > extend the functionality defined in baseClass, analogously to

[Rd] Invalidating inaccessible SEXP?

2007-03-16 Thread Martin Morgan
Is there a (C or R) function to invalidate the relevant parts of SEXP / data that are inaccessible? My problem is in tracking down protection and other memory mismanagement bugs, where I have to rely on luck to invalidate or overwrite data to trigger a detectable error. This makes it hard to track

[Rd] Incomplete valgrind instrumentation level documentation

2007-03-16 Thread Martin Morgan
The 'Writing R Extensions' manual, configure.ac, and the comment at the top of memory.c suggests that there are valgrind instrumentation levels 0, 1, 2 but I think the actual code has four levels. level 0 is no additional instrumentation level 1 marks uninitialized numeric, logical, integer

Re: [Rd] compile 2.4.1 for linux on power cpus SOLVED

2007-03-16 Thread Andrew Ferris
Thank you Ei-ji, That seems to have done it. > .Machine$sizeof.pointer [1] 8 So in total I've done the following to get it work: Installed these readline rpms from the SLES10 media: readline-devel-64bit-5.1-24.4 readline-devel-5.1-24.4 This is the configure command: ./configure CC="gcc -m64

[Rd] NextMethod and $.myclass

2007-03-16 Thread Gabor Grothendieck
The following redefines $ on "myclass" objects so that it looks up the concatenation of the unevaluated second argument and 2 in the object and returns the result: "$.myclass" <- function(x, name) x[[paste(substitute(name), 2, sep = "")]] # test myobject <- structure(list(x2 = 3), class = "myclas

[Rd] Inherited S4 methods

2007-03-16 Thread cstrato
Dear Seth Thank you, maybe I still do not understand S4 methods. I thought that the purpose of function "callNextMethod()" is to allow some kind of inheritance. In the Bioconuductor packages which are using S4, it is only used for method("initialize") but I thought, that it can be used with every

[Rd] Problems with package containing S4 classes

2007-03-16 Thread cstrato
Dear all, Currently, I am trying to create a test package "testS4" using S4 classes, which I am attaching. Running R CMD check gives the following error: coeurebooks-computer:/Volumes/CoreData/CRAN cs$ R CMD check testS4_0.1.1.tar.gz * checking for working latex ...sh: line 1: latex: command

Re: [Rd] Problems with package containing S4 classes

2007-03-16 Thread Benilton Carvalho
your namespace probably contains: useDynLib(testS4) but you don't have any compiled code... remove that line and everything will be fine. btw, if you're playing with S4, you must import 'methods' b On Mar 16, 2007, at 4:55 PM, cstrato wrote: > Dear all, > > Currently, I am trying to create a

[Rd] Incorrect matrix of spearman correlations .... in 64-bit Linux ... (PR#9568)

2007-03-16 Thread vobolonkin
Full_Name: Vladimir Obolonkin Version: tested in 2.0 to 2.4.1 OS: linux, win, mac Submission from: (NULL) (202.14.96.194) {{ Subject shortened manually -- to pass anti-spam filters Original-subject: Incorrect matrix of spearman correlations working \ large (24000 by 425 and 78 by 425 dat

Re: [Rd] Problems with package containing S4 classes

2007-03-16 Thread cstrato
Dear Benilton Thank you, now my package works. Do you have an explanation for my second problem: * Installing *source* package 'mytest' ... ** R ** save image Error in setMethod("export", "derivedClass", export.derivedClass) : no existing definition for function "export" Error: unable to

Re: [Rd] Incorrect matrix of spearman correlations .... in 64-bit Linux ... (PR#9568)

2007-03-16 Thread Peter Dalgaard
[EMAIL PROTECTED] wrote: > Full_Name: Vladimir Obolonkin > Version: tested in 2.0 to 2.4.1 > OS: linux, win, mac > Submission from: (NULL) (202.14.96.194) > > {{ Subject shortened manually -- to pass anti-spam filters > >Original-subject: Incorrect matrix of spearman correlations working \ >

Re: [Rd] Incorrect matrix of spearman correlations .... in 64-bit (PR#9570)

2007-03-16 Thread p . dalgaard
[EMAIL PROTECTED] wrote: > Full_Name: Vladimir Obolonkin > Version: tested in 2.0 to 2.4.1 > OS: linux, win, mac > Submission from: (NULL) (202.14.96.194) > > {{ Subject shortened manually -- to pass anti-spam filters > >Original-subject: Incorrect matrix of spearman correlations working \ >

Re: [Rd] Problems with package containing S4 classes

2007-03-16 Thread Benilton Carvalho
do you have a generic for 'export'? On Mar 16, 2007, at 5:38 PM, cstrato wrote: > Dear Benilton > > Thank you, now my package works. > > Do you have an explanation for my second problem: > > * Installing *source* package 'mytest' ... > ** R > ** save image > Error in setMethod("export", "derivedC

Re: [Rd] Inherited S4 methods

2007-03-16 Thread Seth Falcon
cstrato <[EMAIL PROTECTED]> writes: > Dear Seth > > Thank you, maybe I still do not understand S4 methods. > > I thought that the purpose of function "callNextMethod()" is to allow > some kind of inheritance. In the Bioconuductor packages which are > using S4, it is only used for method("initializ

[Rd] Inherited S4 methods

2007-03-16 Thread cstrato
Dear Seth Thank you, I will further explain this feature. Best regards Christian __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] Problems with package containing S4 classes

2007-03-16 Thread cstrato
Dear Benilton Yes, but the error disappears only when I define it twice. For my package I create three files: 1. MyClasses.R: Here I define the classes only using setClass("baseClass") setClass("derivedClass") 2. methods.baseClass.R Here I define the methods for baseClass setGeneric("export", f

Re: [Rd] Problems with package containing S4 classes

2007-03-16 Thread Benilton Carvalho
Well, my understanding is that if you "need" to define it (the generic) twice you're doing something wrong. Do you have a collate field in your description file? IMHO, the "AllGeneric.R"/"AllClasses.R" approach is the way to go... keeping your code organized is always a good thing, right? b

Re: [Rd] Problems with package containing S4 classes

2007-03-16 Thread cstrato
I agree, but I hope that "AllGeneric.R" is not the only possibility. BTW, what is a collate field? Best regards Christian Benilton Carvalho wrote: > Well, my understanding is that if you "need" to define it (the > generic) twice you're doing something wrong. > > Do you have a collate field in yo

Re: [Rd] Problems with package containing S4 classes

2007-03-16 Thread Benilton Carvalho
The Collate field gives the order that the files are going to be concatenated. If they're concatenated using the "wrong" order, your installation might fail (for example, the generic is defined after the method). A recommended source is the "Writing R Extensions" http://cran.r-project.org/

Re: [Rd] Problems with package containing S4 classes

2007-03-16 Thread cstrato
Thank you, I have already read the R-exts manual, but the collate field is optional. Do you know a package which uses the Collate field so that I can study it? Best regards Christian Benilton Carvalho wrote: > The Collate field gives the order that the files are going to be > concatenated. If t

Re: [Rd] Problems with package containing S4 classes

2007-03-16 Thread Benilton Carvalho
Biobase itself does. b On Mar 16, 2007, at 7:43 PM, cstrato wrote: > Thank you, I have already read the R-exts manual, but the collate > field is optional. > Do you know a package which uses the Collate field so that I can > study it? > > Best regards > Christian > > Benilton Carvalho wrote:

Re: [Rd] R 2.5.0 devel try issue in conjuntion with S4 method dispatch

2007-03-16 Thread Seth Falcon
"Matthias Burger" <[EMAIL PROTECTED]> writes: > Well, I understand I should have spent more time trimming my example > to the minimal required code. Again this piece was copied & reduced. No need to have done anything differently. I commented on the code in hopes that it might be helpful for othe

Re: [Rd] Problems with package containing S4 classes

2007-03-16 Thread cstrato
I must have missed this, thank you. Good night Christian Benilton Carvalho wrote: > Biobase itself does. > b > > On Mar 16, 2007, at 7:43 PM, cstrato wrote: > >> Thank you, I have already read the R-exts manual, but the collate >> field is optional. >> Do you know a package which uses the Collat