Re: [Rd] factor S4 class is NA when as.character method exists

2012-01-23 Thread Dan Murphy
Thank you for your reply, Peter. But that didn't work either. Continuing the example: setGeneric("unique") setMethod("unique", "foo", function(x, incomparables = FALSE, ...){ y <- callNextMethod(x = getDataPart(x), incomparables = incomparables, ...) new("foo", y) }) > unique(bar)

Re: [Rd] Ignore user interrupts

2012-01-23 Thread Sharpie
Sharpie wrote > > If not, would it work to move the function call into a C function that > uses `eval` inside a block protected by BEGIN_SUSPEND_INTERRUPTS? > Just to clarify, if there is no functionality at the R level for evaluating an expression without interrupts, would it be possible to cr

[Rd] Ignore user interrupts

2012-01-23 Thread Sharpie
Is there a way to suspend user interrupts for the duration of a function call? There is a point in one of my packages where values are being written to a Filehash database. If the user is unlucky enough to send an interrupt while this code is active, then they have to: - Hunt down a lock file an

Re: [Rd] factor S4 class is NA when as.character method exists

2012-01-23 Thread peter dalgaard
On Jan 23, 2012, at 16:07 , Dan Murphy wrote: > Hello, > > 'factor' returns for my S4 object when the class is given an > "as.character" method. Here is a minimal example: > >> setClass("foo", contains="numeric") >> bar <- new("foo", 12) >> factor(bar) > [1] 12 > Levels: 12 >> setMethod("as.ch

[Rd] factor S4 class is NA when as.character method exists

2012-01-23 Thread Dan Murphy
Hello, 'factor' returns for my S4 object when the class is given an "as.character" method. Here is a minimal example: > setClass("foo", contains="numeric") > bar <- new("foo", 12) > factor(bar) [1] 12 Levels: 12 > setMethod("as.character", "foo", function(x) paste("x=", x@.Data)) [1] "as.charact