[Rd] Incorrect formatted output after subtracting non-integer seconds from POSIXt origin

2010-09-03 Thread Daniel Murphy
x-as.POSIXct(1970-1-1, tz=UTC)-.5 y-as.POSIXct(1970-1-1, tz=UTC)+.5 x==y [1] FALSE # of course but x and y appear to be the same when formatted, even with extra precision: format(x, format=%Y-%m-%d %H:%M:%OS2) [1] 1970-01-01 00:00:00.50 format(y, format=%Y-%m-%d %H:%M:%OS2) [1] 1970-01-01

Re: [Rd] Incorrect formatted output after subtracting non-integer seconds from POSIXt origin

2010-09-03 Thread Daniel Murphy
Thanks. Yes, negative POSIX time would correspond to dates prior to 1970-1-1, or to dates prior to a more recent origin that borrows functionality from the POSIXt class: as.POSIXct(-.5, origin=as.POSIXct(2011-1-1)). If negative POSIX time is supposed to work then it's a bug in as.POSIXlt().

Re: [Rd] Extract callNextMethod array calls matrix?

2010-07-21 Thread Daniel Murphy
any workaround that avoids the use of callNextMethod on `[` with 3 or more subscripts is a good idea. On 7/20/10 1:41 PM, Daniel Murphy wrote: I have a class that extends array and my method for [ stops with an error: setClass(A, contains=array) [1] A setMethod([, A, function(x, i, j

[Rd] Extract callNextMethod array calls matrix?

2010-07-20 Thread Daniel Murphy
I have a class that extends array and my method for [ stops with an error: setClass(A, contains=array) [1] A setMethod([, A, function(x, i, j, ..., drop = TRUE) new(A, callNextMethod())) [1] [ a-new(A,array(1:12,c(4,3,1))) a An object of class A , , 1 [,1] [,2] [,3] [1,]159

Re: [Rd] S4 class extends data.frame, getDataPart sees list

2010-07-13 Thread Daniel Murphy
equivalent way to deal with the data part. I interpreted cleaner to mean preferred. From your reply, John, it sounds like I should go back to the obj...@.data construct. -Dan On Tue, Jul 13, 2010 at 5:57 AM, John Chambers j...@r-project.org wrote: On 7/11/10 9:08 PM, Daniel Murphy wrote: R-Devel

Re: [Rd] S4 class extends data.frame, getDataPart sees list

2010-07-13 Thread Daniel Murphy
OK, I see. Thanks. -Dan On Tue, Jul 13, 2010 at 9:11 AM, John Chambers j...@r-project.org wrote: On 7/13/10 8:43 AM, Daniel Murphy wrote: Thank you. For getDataPart I was following (my interpretation of) advice from the documentation for Classes: The functions |getDataPart http://127.0.0.1

[Rd] S4 class extends data.frame, getDataPart sees list

2010-07-11 Thread Daniel Murphy
R-Devel: When I get the data part of an S4 class that contains=data.frame, it gives me a list, even when the data.frame is the S4 version: d-data.frame(x=1:3) isS4(d) [1] FALSE # of course dS4-new(data.frame,d) isS4(dS4) [1] TRUE# ok

Re: [Rd] Attributes of 1st argument in ...

2010-07-06 Thread Daniel Murphy
on the first argument, which is back to my original post. I'm guessing that's too difficult to implement. Again, thanks to everyone for your time in schooling me on the issues. :-) Dan On Mon, Jul 5, 2010 at 10:35 PM, Daniel Murphy chiefmur...@gmail.comwrote: I truly am grateful for all

Re: [Rd] Attributes of 1st argument in ...

2010-07-04 Thread Daniel Murphy
Thank you, Professor, for drawing my attention to the nifty tracemem function. I'm using the ..1 syntax to check the properties of the S4 class at function call. The Description at ?cBind tells me that I'm not alone in this predicament. Just as Matrix needs its own cBind function, my package will

Re: [Rd] Attributes of 1st argument in ...

2010-07-03 Thread Daniel Murphy
- function(x, ...) {} ? Hadley On Fri, Jul 2, 2010 at 4:26 PM, Daniel Murphy chiefmur...@gmail.com wrote: R-Devel: I am trying to get an attribute of the first argument in a call to a function whose formal arguments consist of dots only and do something, e.g., call 'cbind', based

[Rd] Attributes of 1st argument in ...

2010-07-02 Thread Daniel Murphy
R-Devel: I am trying to get an attribute of the first argument in a call to a function whose formal arguments consist of dots only and do something, e.g., call 'cbind', based on the attribute f- function(...) {get first attribute; maybe or maybe not call 'cbind'} I thought of (ignoring

[Rd] format: different S4 behavior in a package

2010-06-23 Thread Daniel Murphy
R-Devel-ers: I have an S4 method that simply formats an object: setGeneric(formatMe, function(x) standardGeneric(formatMe)) setMethod(formatMe, ANY, function(x) format(x)) If I issue the above in an R session, then define an S4 class with its own format method, I get the desired result:

Re: [Rd] format: different S4 behavior in a package

2010-06-23 Thread Daniel Murphy
Thank you, Martin. That worked. And fyi 'export(format)' alone was not sufficient. Best, Dan On Wed, Jun 23, 2010 at 5:15 AM, Martin Morgan mtmor...@fhcrc.org wrote: On 06/23/2010 12:16 AM, Daniel Murphy wrote: R-Devel-ers: I have an S4 method that simply formats an object: setGeneric

Re: [Rd] Extract/format/show for S4 objects (Johann Hibschman)

2010-06-09 Thread Daniel Murphy
Johann, Following up on Gabor's reply, the mondate package (new on CRAN last week) will accomplish your needs. I'm trying to make an integer-backed quarter (as in fraction of year) class, but I can't quite it to work. I want integer-backed so I don't have to worry about floating-point effects

Re: [Rd] pretty.Date(): new halfmonth time step

2010-05-20 Thread Daniel Murphy
calculations. It could serve other purposes just fine, however. Best regards, Dan On Wed, May 19, 2010 at 7:48 PM, Felix Andrews fe...@nfrac.org wrote: On 20 May 2010 11:56, Daniel Murphy chiefmur...@gmail.com wrote: Much better to implement directly what this is trying to do: i.e. to have

Re: [Rd] pretty.Date(): new halfmonth time step

2010-05-20 Thread Daniel Murphy
= argument, e.g. library(zoo) ym - as.yearmon(2010-01) as.Date(ym, frac = 0.5) [1] 2010-01-16 On Wed, May 19, 2010 at 9:56 PM, Daniel Murphy chiefmur...@gmail.com wrote: Much better to implement directly what this is trying to do: i.e. to have a halfmonth time step. This is just the union

[Rd] pretty.Date(): new halfmonth time step

2010-05-19 Thread Daniel Murphy
Much better to implement directly what this is trying to do: i.e. to have a halfmonth time step. This is just the union of two monthly sequences, one on the 1st of each month and another on the 15th of each month. For some applications that might be true. But not for others. For a month with 31

[Rd] format.data.frame containing S4 class with format method

2010-05-17 Thread Daniel Murphy
Hi again, I must be misunderstanding something fundamental about how an S4 class stored in a data.frame can be persuaded to print according to a desired format. The help page says: format.data.frame formats the data frame column by column, applying the appropriate method of format for each

[Rd] Validity glitch when contains=matrix

2010-05-05 Thread Daniel Murphy
Sirs: My validity function did not run when my class contains=matrix. But if I first define the class with contains=numeric, then define it again with contains=matrix, validity runs. Here's the session: f - function(object) BAD CLASS # force error to setClass(A, contains=matrix, validity=f)

[Rd] S4 method execution time

2010-04-30 Thread Daniel Murphy
Hello: I have written some an elementary S4 classes around a matrix to strengthen control of some key attributes. When I run a fairly elementary function (f) on the matrix outside the class it runs instantaneously (elapsed system.time = 0) but when I setMethod f on myClass -- returning an

[Rd] choose.files() latent highlighting in console

2009-12-09 Thread Daniel Murphy
Greetings, When I call choose.files() from within a Windows (Vista or XP) Rgui.exe (2.10.0) session and double-click my choice, a large section of the text in the 'R Console' window appears as selected (highlighted in blue) when control returns to the console. The end point of the selected text

[Rd] Help in 2.10 lost its Find feature

2009-11-11 Thread Daniel Murphy
Sirs: I understand that no one wanted to maintain the old Help, but one feature I used extensively -- as a newbie to R or to an unfamiliar package -- was the capability of searching for a word or phrase on the Help page itself. Ctrl-F/Command-F (Windows/mac) 'differently-phrased-capability' was a

Re: [Rd] Help in 2.10 lost its Find feature

2009-11-11 Thread Daniel Murphy
That did it. Was having trouble searching 'help' for how to optionally configure 'help'. Thanks. -Dan On Wed, Nov 11, 2009 at 8:57 AM, Henrik Bengtsson h...@stat.berkeley.eduwrote: For the text based help, there is no search feature on Windows, e.g. options(help_type=text); help(readLines);

Re: [Rd] Match .3 in a sequence

2009-03-16 Thread Daniel Murphy
) # absolute tolerance rapproxin - function(x,list,tol) (x==0 0 %in% list) || any(abs((list-x)/x)=tol,na.rm=TRUE) # relative tolerance; only exact 0 will match 0 Hope this helps, -s On Mon, Mar 16, 2009 at 9:36 AM, Daniel Murphy chiefmur...@gmail.com wrote: Hello:I am trying

Re: [Rd] Match .3 in a sequence

2009-03-16 Thread Daniel Murphy
in the factor. This would be weird even if it didn't lead to this very bad case. Hope this helps, -s On Mon, Mar 16, 2009 at 6:53 PM, Daniel Murphy chiefmur...@gmail.com wrote: I have a matrix whose columns were filled with values which were functions of cvseq-seq(.2,.3