Re: [Rd] Problem with defining new method for residuals()

2011-03-10 Thread Martin Morgan
On 03/10/2011 08:21 AM, ONKELINX, Thierry wrote: > Dear all, > > I'm writing a package and I would like to reuse the residuals() > function. When I use a function which calls the redefined residuals > (for my custom class) I get an error (see below). It looks like the > wrong method is used. The s

[Rd] unique.matrix issue [Was: Anomaly with unique and match]

2011-03-10 Thread Terry Therneau
Simon pointed out that the issue I observed was due to internal behaviour of unique.matrix. I had looked carefully at the manual pages before posting the question and this was not mentioned. Perhaps an addition could be made? Terry T. __ R-devel@r-p

Re: [Rd] Testing for a reference class object

2011-03-10 Thread John Chambers
There is a virtual class "refClass" that all reference classes subclass, so is(x, "refClass") is the natural test, as in: > foo <- setRefClass("foo", fields = "bar") > x <- foo$new() > is(x, "refClass") [1] TRUE On 3/10/11 7:40 AM, Jeffrey Horner wrote: Hi all, I've constructed the following

Re: [Rd] Create an environment and assign objects to it in one go?

2011-03-10 Thread Henrik Bengtsson
Hi, thanks to both of you. My use case was actually to in-the-end create a *list* in a cut'n'paste-friendly way, e.g. env <- function(..., hash=FALSE, parent=parent.frame(), size=29L) { envir <- new.env(hash=hash, parent=parent, size=size); evalq(..., envir=envir);   envir; } # env() x <-

[Rd] Problem with defining new method for residuals()

2011-03-10 Thread ONKELINX, Thierry
Dear all, I'm writing a package and I would like to reuse the residuals() function. When I use a function which calls the redefined residuals (for my custom class) I get an error (see below). It looks like the wrong method is used. The strange this is, that when it execute the code manually it

[Rd] Testing for a reference class object

2011-03-10 Thread Jeffrey Horner
Hi all, I've constructed the following function to test whether or not an object was created from a reference class: isRefClassObject <- function(x) isS4(x) && is.environment(attr(x,'.xData')) && exists('.refClassDef',attr(x,'.xData')) but I'm unsure if it's a complete test or if there's a bette

Re: [Rd] Create an environment and assign objects to it in one go?

2011-03-10 Thread Gabor Grothendieck
On 3/10/11, Henrik Bengtsson wrote: > Hi, > > I've just created: > > newEnvEval <- function(..., hash=FALSE, parent=parent.frame(), size=29L) { > envir <- new.env(hash=hash, parent=parent, size=size); > evalq(..., envir=envir); > envir; > } # newEnvEval() > > so that I can create an environm

Re: [Rd] R and ATLAS and distributing across boxes

2011-03-10 Thread Dirk Eddelbuettel
On 9 March 2011 at 14:34, Adam D. I. Kramer wrote: | If I have a cluster of heterogenous machines, each with their own | self-optimized ATLAS, do I need to compile R on each machine to tell it to | take advantage of the local ATLAS? Or is it sufficient to compile R once | with the appropriat

[Rd] about textConnection

2011-03-10 Thread WANGSONG
I need read a table in a string with special format. I used read.csv and textConnection function. But i am confuse about textConnection by follow code. case A: It is OK£¡ str0 <- '{"abc",{"def","X,1&Y,2&Z,3"}}' str1 <- strsplit(str0,'"')[[1]][6] str2 <- gsub("&","\n", str1) con <- textC

Re: [Rd] unique.matrix issue [Was: Anomaly with unique and match]

2011-03-10 Thread Henrik Bengtsson
It should be possible to run unique()/duplicated() column by column and incrementally update the set of unique/duplicated rows. This would avoid any coercing. The benefit should be even greater for data.frame():s. My $.02 /Henrik On Thu, Mar 10, 2011 at 12:29 AM, Petr Savicky wrote: > On Wed,

Re: [Rd] unique.matrix issue [Was: Anomaly with unique and match]

2011-03-10 Thread Petr Savicky
On Wed, Mar 09, 2011 at 02:11:49PM -0500, Simon Urbanek wrote: > match() is a red herring here -- it is really a very specific thing that has > to do with the fact that you're running unique() on a matrix. Also it's much > easier to reproduce: > > > x=c(1,1+0.2e-15) > > x > [1] 1 1 > > sprintf("