On Tue, Sep 27, 2011 at 5:56 AM, Ashim Kapoor wrote:
> Dear R-helpers,
>
> It seems to me that a character zoo cannot be coerced to a numeric zoo.
> Below is a minimal example. Can someone tell me what I have done wrong?
>
>> z<-zoo(1:4,order.by=1:4)
>> coredata(z)<-as.character(coredata(z))
>> st
Yes, that sounds right.
Michael
PS -- If you are interested, the code zoo:::`coredata<-.zoo` contains the
line
x[] <- value
confirming my hunch about the old mode being inherited unless a coercion to
a more general one is needed.
On Tue, Sep 27, 2011 at 7:01 AM, Ashim Kapoor wrote:
> Dear Mi
Dear Micheal,
Thank you. So to make a zoo which has factors in into a numeric,we have to
go from factor to character to numeric. The coredata goes fine from factor
to character. In the numeric conversion we need a new zoo object.
Best,
Ashim
On Tue, Sep 27, 2011 at 4:21 PM, R. Michael Weylandt <
It's just a guess from playing around with a few things. The author of the
package is on this list and he could both confirm that I'm right and say why
exactly it is implemented like this.
My hunch is that it ultimately comes from the fact that
coredata(z) != z
Consider this:
x = letters[1:5]
x
Dear Michael,
I don't think this is mentioned in the zoo FAQ. May I ask where you read
this? Some references ?
Thank you for your help,
Ashim
On Tue, Sep 27, 2011 at 4:06 PM, R. Michael Weylandt <
michael.weyla...@gmail.com> wrote:
> Yes, once made into a character zoo, the core data is marked
Yes, once made into a character zoo, the core data is marked to be of mode
"character" and most attempts to modify involve implicit coercion to that
mode.
The following however works:
library(zoo)
z <- zoo(1:4, order.by=1:4)
str(z)
z.Str <- z
coredata(z.Str) <- as.character(coredata(z))
str(z.St
Dear R-helpers,
It seems to me that a character zoo cannot be coerced to a numeric zoo.
Below is a minimal example. Can someone tell me what I have done wrong?
> z<-zoo(1:4,order.by=1:4)
> coredata(z)<-as.character(coredata(z))
> str(z)
zoo series from 1 to 4
Data: chr [1:4] "1" "2" "3" "4"
7 matches
Mail list logo