Re: [Rd] super basic questions about S4 classes

2011-04-08 Thread Andreas Borg
Hi Andre, 1. Keep in mind that a S4 method belongs to a specific generic function, not to a specific object or class. There is none such thing as a "class member function" in the S4 system. As an example for illustration, consider the following class definitions in Java: class myClassA { int

Re: [Rd] core Matrix package segfaulted on R CMD check --use-gct

2011-04-08 Thread Prof Brian Ripley
On Fri, 8 Apr 2011, peter dalgaard wrote: (Resending with fewer recipients...) On Apr 8, 2011, at 07:09 , Hin-Tak Leung wrote: --- On Fri, 8/4/11, peter dalgaard wrote: On Apr 7, 2011, at 23:57 , Hin-Tak Leung wrote: Oh, I am tracking both R and Matrix via git-svn and retrieves all rev

[Rd] Invalid connection after closing?

2011-04-08 Thread Joris Meys
Dear all, I do not completely understand following behaviour : > con <- file("test.txt") > isOpen(con) [1] FALSE > open(con) > isOpen(con) [1] TRUE > close(con) > isOpen(con) Error in isOpen(con) : invalid connection > str(con) Classes 'file', 'connection' atomic [1:1] 3 ..- attr(*, "conn_id")

[Rd] duplicates() function

2011-04-08 Thread Duncan Murdoch
I need a function which is similar to duplicated(), but instead of returning TRUE/FALSE, returns indices of which element was duplicated. That is, > x <- c(9,7,9,3,7) > duplicated(x) [1] FALSE FALSE TRUE FALSE TRUE > duplicates(x) [1] NA NA 1 NA 2 (so that I know that element 3 is a dupli

Re: [Rd] duplicates() function

2011-04-08 Thread Joshua Ulrich
How about: y <- rep(NA,length(x)) y[duplicated(x)] <- match(x[duplicated(x)] ,x) -- Joshua Ulrich  |  FOSS Trading: www.fosstrading.com On Fri, Apr 8, 2011 at 9:59 AM, Duncan Murdoch wrote: > I need a function which is similar to duplicated(), but instead of returning > TRUE/FALSE, returns in

Re: [Rd] Invalid connection after closing?

2011-04-08 Thread Duncan Murdoch
On 08/04/2011 10:56 AM, Joris Meys wrote: Dear all, I do not completely understand following behaviour : > con<- file("test.txt") > isOpen(con) [1] FALSE > open(con) > isOpen(con) [1] TRUE > close(con) > isOpen(con) Error in isOpen(con) : invalid connection > str(con) Classes 'file', 'co

Re: [Rd] duplicates() function

2011-04-08 Thread Duncan Murdoch
On 08/04/2011 11:08 AM, Joshua Ulrich wrote: How about: y<- rep(NA,length(x)) y[duplicated(x)]<- match(x[duplicated(x)] ,x) That's a nice solution for vectors. Unfortunately for me, I have a matrix (which duplicated() handles by checking whole rows). So a better example that I should have

Re: [Rd] duplicates() function

2011-04-08 Thread Hadley Wickham
On Fri, Apr 8, 2011 at 9:59 AM, Duncan Murdoch wrote: > I need a function which is similar to duplicated(), but instead of returning > TRUE/FALSE, returns indices of which element was duplicated.  That is, > >> x <- c(9,7,9,3,7) >> duplicated(x) > [1] FALSE FALSE  TRUE FALSE TRUE > >> duplicates(x

Re: [Rd] Invalid connection after closing?

2011-04-08 Thread Joris Meys
Thx for the information. I read it, but I wasn't sure what was going on inside. Is there a way to close a connection without destroying it? Guess not, but you never know... Cheers Joris On Fri, Apr 8, 2011 at 5:09 PM, Duncan Murdoch wrote: > On 08/04/2011 10:56 AM, Joris Meys wrote: >> >> Dear a

Re: [Rd] duplicates() function

2011-04-08 Thread Kasper Daniel Hansen
On Fri, Apr 8, 2011 at 11:08 AM, Joshua Ulrich wrote: > How about: > > y <- rep(NA,length(x)) > y[duplicated(x)] <- match(x[duplicated(x)] ,x) > I use Joshua's trick all the time. But it might still be nice with a C implementation. While we are discussing duplication, I would also like to see s

Re: [Rd] How to debug reference classes?

2011-04-08 Thread A Zege
Thank you very much, gentlemen. It seems reference classes will make my life much easier. I won't pretend that i fully understand the wizardry with environments that you do, but it works :). Namely the steps to mtrace a class method by doing what John and Mark outlined xx$edit<-xx$edit mtrace

Re: [Rd] duplicates() function

2011-04-08 Thread Joshua Ulrich
On Fri, Apr 8, 2011 at 10:15 AM, Duncan Murdoch wrote: > On 08/04/2011 11:08 AM, Joshua Ulrich wrote: >> >> How about: >> >> y<- rep(NA,length(x)) >> y[duplicated(x)]<- match(x[duplicated(x)] ,x) > > That's a nice solution for vectors.  Unfortunately for me, I have a matrix > (which duplicated() h

Re: [Rd] Invalid connection after closing?

2011-04-08 Thread Prof Brian Ripley
On Fri, 8 Apr 2011, Joris Meys wrote: Thx for the information. I read it, but I wasn't sure what was going on inside. Then perhaps you needed to do your homework: the references on the help page would have explained it to you. Is there a way to close a connection without destroying it? Gue

Re: [Rd] duplicates() function

2011-04-08 Thread William Dunlap
> -Original Message- > From: r-devel-boun...@r-project.org > [mailto:r-devel-boun...@r-project.org] On Behalf Of Duncan Murdoch > Sent: Friday, April 08, 2011 8:16 AM > To: Joshua Ulrich > Cc: R-devel@r-project.org > Subject: Re: [Rd] duplicates() function > > On 08/04/2011 11:08 AM, Josh

Re: [Rd] core Matrix package segfaulted on R CMD check --use-gct

2011-04-08 Thread Hin-Tak Leung
--- On Fri, 8/4/11, peter dalgaard wrote: > On Apr 7, 2011, at 23:57 , Hin-Tak Leung wrote: > > > > > Oh, I am tracking both R and Matrix via git-svn and > retrieves all revisions to all branches daily (or at least, > regularly). I.e. R svn head.  2.13.0 only forked off > recently and most of t

Re: [Rd] core Matrix package segfaulted on R CMD check --use-gct

2011-04-08 Thread peter dalgaard
On Apr 7, 2011, at 23:57 , Hin-Tak Leung wrote: > > Oh, I am tracking both R and Matrix via git-svn and retrieves all revisions > to all branches daily (or at least, regularly). I.e. R svn head. 2.13.0 only > forked off recently and most of the trunk<->2.13.0rc differences are so far > mostl

Re: [Rd] question about assignment warnings for replacement methods

2011-04-08 Thread Hervé Pagès
Hi Duncan, Marc, On 11-04-05 11:15 AM, Duncan Murdoch wrote: On 05/04/2011 1:51 PM, Marc Carlson wrote: Hi, I have seen several packages that with the most recent version of R are giving a warning like this: Assignments in \usage in documentation object 'marginalData-methods': marginalData(ob

Re: [Rd] question about assignment warnings for replacement methods

2011-04-08 Thread Simon Urbanek
On Apr 8, 2011, at 2:55 PM, Hervé Pagès wrote: > Hi Duncan, Marc, > > On 11-04-05 11:15 AM, Duncan Murdoch wrote: >> On 05/04/2011 1:51 PM, Marc Carlson wrote: >>> Hi, >>> >>> I have seen several packages that with the most recent version of R are >>> giving a warning like this: >>> >>> Assign

[Rd] Consistency of messages from R CMD {check,build,install}

2011-04-08 Thread Michael Friendly
A minor gripe/request: Could all R CMD package tools not at the very least be consistent in indicating when they are done, as in * DONE (packagename) or at least * DONE R CMD build leaves one hanging, not knowing whether it has completed or it is time to get another coffee. * checking for fi

[Rd] Compression of largish expression array files in the DAAGbio/inst/doc directory?

2011-04-08 Thread John Maindonald
The inst/doc directory of the DAAG package has 6 files coral551.spot, ... that are around 0.85 MB each. It would be useful to be able to zip then, but that as matters stand interferes with the use of the Sweave file that uses them to demonstrate input of expression array data that is in the "spot"

Re: [Rd] Compression of largish expression array files in the DAAGbio/inst/doc directory?

2011-04-08 Thread Prof Brian Ripley
As far as I can see read.maimages is built on top of R's own file-reading facilties, and they all read compressed (but not zipped) files as from R 2.10.0. So simply use gzip -9 coral55?.spot and rename the files back to *.spot. If you need more compression, use xz -9e. (You can also do this