Re: [R] as.vector with mode="list" and POSIXct

2013-05-22 Thread Alexandre Sieira
That's a very interesting point, David. The part I actually didn't know is that the class of an object is an attribute, and that by "removing all attributes" the function would in effect unclass it. Thank you. --  Alexandre Sieira CISA, CISSP, ISO 27001 Lead Auditor "The truth is rarely pure a

Re: [R] as.vector with mode="list" and POSIXct

2013-05-22 Thread William Dunlap
lap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of David Winsemius > Sent: Wednesday, May 22, 2013 1:52 PM > To: Alexandre Sieira > Cc: r-help@r-project.org > Subject: Re: [R] as.vector with mo

Re: [R] as.vector with mode="list" and POSIXct

2013-05-22 Thread David Winsemius
On May 20, 2013, at 2:09 PM, Alexandre Sieira wrote: > I was trying to convert a vector of POSIXct into a list of POSIXct, However, > I had a problem that I wanted to share with you. > > Works fine with, say, numeric: > > >> v = c(1, 2, 3) >> v > [1] 1 2 3 >> str(v) > num [1:3] 1 2 3 >> l =

Re: [R] as.vector with mode="list" and POSIXct

2013-05-22 Thread Bert Gunter
Gents: You've both been polite and thoughtful, but I think you should take your discussion private, no? -- Bert On Wed, May 22, 2013 at 12:57 PM, Alexandre Sieira wrote: > Please let's not turn this into an ad hominem discussion by adding remarks on > what the other thinks or knows, as this wi

Re: [R] as.vector with mode="list" and POSIXct

2013-05-22 Thread Alexandre Sieira
Please let's not turn this into an ad hominem discussion by adding remarks on what the other thinks or knows, as this will get us nowhere fast. Let's focus on the issue, ok? :) Again, the point behind my workaround was to try to change the rest of my program as little as possible while I waited

Re: [R] as.vector with mode="list" and POSIXct

2013-05-22 Thread Jeff Newmiller
My perception of illogic was in your addition of more data structure complexity when faced with this difficulty. R has best performance when calculations are pushed into simple typed vectors where precompiled code can handle the majority of the work. These are simpler structures, not more comple

Re: [R] as.vector with mode="list" and POSIXct

2013-05-22 Thread Alexandre Sieira
Hi, Jeff. Thanks for your thoughtful suggestions. I do not plan to wait for the hash package to be redesigned to meet my expectations. As a matter of fact, I have: a) Submitted a report of unexpected behavior in hash::values, which the package maintainer quickly replied to and said would exami

Re: [R] as.vector with mode="list" and POSIXct

2013-05-21 Thread Jeff Newmiller
I recommend that you not plan on waiting for the hash package to be redesigned to meet your expectations. Also, your response to discovering this feature of the hash package seems illogical. >From a computer science perspective, the hash mechanism is an implementation >trick that is intended to

Re: [R] as.vector with mode="list" and POSIXct

2013-05-21 Thread Alexandre Sieira
You are absolutely right. I am storing POSIXct objects into a hash (from the hash package). However, if I try to get them out as a vector using the values() function, they are unclassed. And that breaks my (highly vectorized) code. Take a look at this: > h = hash() > h[["a"]] = Sys.time() > st

Re: [R] as.vector with mode="list" and POSIXct

2013-05-20 Thread Jeff Newmiller
I don't know what you plan to do with this list, but lists are quite a bit less efficient than fixed-mode vectors, so you are likely losing a lot of computational speed by using this list. I don't hesitate to use simple data frames (lists of vectors), but processing lists is on par with for loop

Re: [R] as.vector with mode="list" and POSIXct

2013-05-20 Thread Alexandre Sieira
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Alexandre Sieira > Sent: Monday, May 20, 2013 2:10 PM > To: r-help@r-project.org > Subject: [R] as.vector with mode="list" and POSIXct > > I was trying to conver

Re: [R] as.vector with mode="list" and POSIXct

2013-05-20 Thread William Dunlap
elp-boun...@r-project.org] On > Behalf > Of Alexandre Sieira > Sent: Monday, May 20, 2013 2:10 PM > To: r-help@r-project.org > Subject: [R] as.vector with mode="list" and POSIXct > > I was trying to convert a vector of POSIXct into a list of POSIXct, However, > I had

[R] as.vector with mode="list" and POSIXct

2013-05-20 Thread Alexandre Sieira
I was trying to convert a vector of POSIXct into a list of POSIXct, However, I had a problem that I wanted to share with you. Works fine with, say, numeric: > v = c(1, 2, 3) > v [1] 1 2 3 > str(v)  num [1:3] 1 2 3 > l = as.vector(v, mode="list") > l [[1]] [1] 1 [[2]] [1] 2 [[3]] [1] 3 > str(