[R] checking frequency in xts and zoo objects

Erin Hodgess erinm.hodgess at gmail.com
Tue Apr 13 05:46:24 CEST 2010


Thank you!

Here is something that I just ran into.  I have a business day series,
spc, which I obtained using get.hist.quote.

When I tried frequency(spc), I got 1.


> str(spc)
‘zoo’ series from 1998-01-02 to 2010-04-09
  Data: num [1:3086, 1] 975 977 967 964 956 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr "Close"
  Index: Class 'Date'  num [1:3086] 10228 10231 10232 10233 10234 ...
> frequency(spc)
[1] 1
>

Am I doing something wrong(high probability) or maybe frequency does
not work the same with business day data, please?

Thanks,
Erin



On Mon, Apr 12, 2010 at 10:29 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> Note that the preferred way of doing this with ts series is to use the
> frequency() function rather than using tsp.   That function also works
> for zoo objects.
>
> On Mon, Apr 12, 2010 at 11:20 PM, Erin Hodgess <erinm.hodgess at gmail.com> wrote:
>> Dear R People:
>>
>> When I have a time series, I can get the frequency of the series via tsp(x)[3].
>>
>> Is there a similar function for xts and zoo objects, please?
>>
>> Thanks,
>> Erin
>>
>>
>> --
>> Erin Hodgess
>> Associate Professor
>> Department of Computer and Mathematical Sciences
>> University of Houston - Downtown
>> mailto: erinm.hodgess at gmail.com
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>



-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com



More information about the R-help mailing list