Skip to content
Back to formatted view

Raw Message

Message-ID: <AANLkTim98NUjOs_8vJt9WD_bgNBzyYjgrKCVbr9H93na@mail.gmail.com>
Date: 2011-01-31T18:21:27Z
From: Gabor Grothendieck
Subject: Question on zoo time series
In-Reply-To: <AANLkTikErds3djaaSqYrTS+MDhYG_CnrYecwpP49ZjdE@mail.gmail.com>

On Mon, Jan 31, 2011 at 12:51 PM, Megh Dal <megh700004 at gmail.com> wrote:
> Hi, let say, I have following execution:
>
> ?> library(zoo)
>> library(quantmod)
>> PriceDat <- as.zoo(get(getSymbols("APL"))[,4])
>> is.numeric(PriceDat)
> [1] TRUE
>> PriceDat <- zoo(data.frame(Price=coredata(PriceDat), Others="APL"),
> index(PriceDat))
>> is.numeric(PriceDat$Price)
> [1] FALSE
>>
>
>
> Here surpricingly, once I create a data-frame I see that "Price"
> observations become non-numeric. Can someone please explain this, why it is
> so? Shouldn't I expect it will remain Numeric?
>

What you have actually done is create a data frame in which one column
is c("APL", "APL", ..., "APL") and then tried to convert that to zoo.

What you intended was likely:

merge(PriceDat, APL)


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com