[R-SIG-Finance] zoo plotting - invalid 'ylim' value

Gabor Grothendieck ggrothendieck at gmail.com
Thu Jun 18 05:11:17 CEST 2009


Or perhaps even better, colClasses = "numeric"

> z <- read.zoo(textConnection(Lines), sep = ",", colClasses = "numeric")
> str(z)
‘zoo’ series from 3 to 5
  Data: num [1:3] NA 6 NA
  Index:  num [1:3] 3 4 5


On Wed, Jun 17, 2009 at 10:58 PM, Gabor
Grothendieck<ggrothendieck at gmail.com> wrote:
> Check out the na.strings= argument:
>
>> Lines <- "3, NA
> + 4,6
> + 5, NA"
>> library(zoo)
>> z <- read.zoo(textConnection(Lines), sep = ",", na.strings = " NA")
>> str(z)
> ‘zoo’ series from 3 to 5
>  Data: int [1:3] NA 6 NA
>  Index:  int [1:3] 3 4 5
>
>
> On Wed, Jun 17, 2009 at 10:43 PM, spencerg<spencer.graves at prodsyse.com> wrote:
>> Hi, Gabor:
>>
>>     I just lost perhaps a day's work due to that very problem:  I couldn't
>> get read.zoo to work, so I used read.table, which created factors, because
>> some of my numeric columns included, ", NA", which got translated as a level
>> " NA" (note this three character code with a space before the NA).  Then I
>> did "as.matrix" of the data.frame that I thought was numeric;  the result
>> was a zoo object with coredata of class character rather than numeric.
>>
>>     Best Wishes,
>>     Spencer
>>
>> Gabor Grothendieck wrote:
>>>
>>> Just to follow up the thread so that it is not left dangling
>>> the problem was that the object in question had character
>>> rather than numeric data in it.
>>>
>>> On Wed, Jun 17, 2009 at 1:58 PM, Gabor
>>> Grothendieck<ggrothendieck at gmail.com> wrote:
>>>
>>>>
>>>> What is the result of
>>>>
>>>> dput(stb.foreign)
>>>>
>>>>
>>>>
>>>> On Wed, Jun 17, 2009 at 1:53 PM, Khanh Nguyen<knguyen at cs.umb.edu> wrote:
>>>>
>>>>>
>>>>> Hi all,
>>>>>
>>>>> I am very new to 'zoo', so this could probably be a trivia question,
>>>>> but I got the above error when I plot my zoo object
>>>>>
>>>>>
>>>>>>
>>>>>> plot(stb.foreign) #this work fine
>>>>>>        stb.foreign$room.con.lai
>>>>>>
>>>>>
>>>>>  2009-05-28  2009-05-29  2009-06-01  2009-06-02  2009-06-03
>>>>> 2009-06-04  2009-06-05
>>>>> 11104740    10772400    10775110    10397160    10037930     9986480
>>>>>  10003780
>>>>>  2009-06-08  2009-06-09  2009-06-10  2009-06-11  2009-06-12
>>>>> 2009-06-15  2009-06-16
>>>>> 10163340    10545920    11020540    10720430    10484040    10502080
>>>>>  10932930
>>>>>  2009-06-17
>>>>> 11201700
>>>>>
>>>>>
>>>>>>
>>>>>> plot(stb.foreign$room.con.lai)
>>>>>>
>>>>>
>>>>> Error in plot.window(...) : invalid 'ylim' value
>>>>>      Thanks
>>>>>
>>>>> -k
>>>>>
>>>>> _______________________________________________
>>>>> R-SIG-Finance at stat.math.ethz.ch mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>>>> -- Subscriber-posting only.
>>>>> -- If you want to post, subscribe first.
>>>>>
>>>>>
>>>
>>> _______________________________________________
>>> R-SIG-Finance at stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>> -- Subscriber-posting only.
>>> -- If you want to post, subscribe first.
>>>
>>>
>>
>>
>



More information about the R-SIG-Finance mailing list