Re: [R] any updates w.r.t. lapply, sapply, apply retaining classes

2011-11-03 Thread Joshua Wiley
Hi Mike, I definitely understand your point. I don't have any particularly good ideas, though I think you might like S4, which is the newer formal class/methods system. As a note, I misspoke (or miswrote) that difftime inherits from numeric---the mode is numeric, but does not inherit. Cheers,

Re: [R] any updates w.r.t. lapply, sapply, apply retaining classes

2011-11-03 Thread Hadley Wickham
>    I agree that it is non-trivial to solve the cases you & I have posed. >  However, I would wholeheartedly support having an error spit back for any > function that does not explicitly support a class.  In this case, if I > attempt to do   sapply(x, class), and 'x' is of class "difftime", then I

Re: [R] any updates w.r.t. lapply, sapply, apply retaining classes

2011-11-03 Thread Hadley Wickham
>    In the example I give above, the impact might seem small, but the > implications are *huge*.  This means that I am, in effect, not allowed to > use *any* of the vectoring functions in 'R', which avoid performing loops > thereby speeding up process time extraordinarily.  Many can sympathize tha

Re: [R] any updates w.r.t. lapply, sapply, apply retaining classes

2011-11-03 Thread Richard M. Heiberger
Mike, On time classes specifically, the lubridate package with documentation Garrett Grolemund, Hadley Wickham (2011). Dates and Times Made Easy with lubridate. Journal of Statistical Software, 40(3), 1-25. http://www.jstatsoft.org/v40/i03/. solves many confusion problems. Does it handle the

Re: [R] any updates w.r.t. lapply, sapply, apply retaining classes

2011-11-03 Thread Mike Williamson
Hi Joshua, Thank you for the input! I agree that it is non-trivial to solve the cases you & I have posed. However, I would wholeheartedly support having an error spit back for any function that does not explicitly support a class. In this case, if I attempt to do sapply(x, class), and

Re: [R] any updates w.r.t. lapply, sapply, apply retaining classes

2011-11-03 Thread Joshua Wiley
Hi Mike, This isn't really an answer to your question, but perhaps will serve to continue discussion. I think that there are some fundamental issues when working special classes. As a thought example, suppose I wrote a class, "posreal", which inherits from the numeric class. It is only valid fo

[R] any updates w.r.t. lapply, sapply, apply retaining classes

2011-11-03 Thread Mike Williamson
Hi All, I don't have a "I need help" question, so much as a query into any update whether 'R' has made any progress with some of the core functions retaining classes. As an example, because it's one of the cases that most egregiously impacts me & my work and keeps pushing me away from 'R' and