Skip to content

Zoo functions

8 messages · MAB, Dirk Eddelbuettel, Gabor Grothendieck

MAB
#
Hi!

1) The documentation for the zoo package indicates a function lag.zoo .
I can't find it when I try to use it or do a help(lag.zoo). I can find all the 
other zoo functions I tried so far (allthough diff.zoo is missing also).

Any hints?

2) What does the following message imply?

Warning message:
some methods for "zoo" objects do not work if the index entries in 'order.by' 
are not unique in: zoo(rval, x.index[i]) 


Thanks for your help,

Michel
#
On Feb 1, 2008 3:29 PM, MAB <MichelBeck at sbcglobal.net> wrote:
Maybe you forgot to issue library(zoo) first or perhaps there
is something wrong with your installation. help(lag.zoo) and
help(diff.zoo) both work for me and point to the same page.
Also, those and all other zoo help files can be found online:

http://cran.r-project.org/src/contrib/Descriptions/zoo.html
See #1 in the faq:

vignette("zoo-faq")

or get the FAQ at the link mentioned above.
#
On 1 February 2008 at 20:29, MAB wrote:
| 1) The documentation for the zoo package indicates a function lag.zoo .
| I can't find it when I try to use it or do a help(lag.zoo). I can find all the 
| other zoo functions I tried so far (allthough diff.zoo is missing also).
| 
| Any hints?

Error on your part. The form is function.class, and the .class (here .zoo)
part is ued for internal dispatching of methods to the correct class -- here
zoo.

Do

	> library(zoo)
	> help(lag)

or

	> help(lag, package="zoo")


| 2) What does the following message imply?
| 
| Warning message:
| some methods for "zoo" objects do not work if the index entries in 'order.by' 
| are not unique in: zoo(rval, x.index[i]) 

Two of the letters in zoo stand for 'ordered observations', and zoo expects
these to to (strictly) monotonically increasing. You get by with ties in the
sense that neither the constructor nor the other functions die on you, but
they reserve the right to warn you.  Which happened here.  If you check

	> summary(diff(x.index[i]))

you probably find that the minimum (difference) is not a positive number. You
want it to be one, in most cases.

Dirk
2 days later
MAB
#
Dirk Eddelbuettel <edd <at> debian.org> writes:
the
Hi Dirk!

So do I understand correctly that I should not attempt to use a function 
lag.zoo but should use the function lag after loading the zoo library?

This is what I did:

1) I reinstalled zoo
2) I loaded zoo
3) I typed in the commands


library(zoo)
test <- zoo(1:10)
lag.zoo(test)

and got

Error: could not find function "lag.zoo"

SO I should type in lag only to get the proper result?


Thanks,

Michel

PS Indeed I have always been getting the help pages for lag.zoo and diff.zoo
#
On 4 February 2008 at 17:35, MAB wrote:
| So do I understand correctly that I should not attempt to use a function 
| lag.zoo but should use the function lag after loading the zoo library?

Correct:
2008-02-04 2008-02-05 2008-02-06 2008-02-07 
         1          2          3          4
2008-02-04 2008-02-05 2008-02-06 2008-02-07 
         1          2          3          4
2008-02-04 2008-02-05 2008-02-06 
         2          3          4
2008-02-05 2008-02-06 2008-02-07 
         1          2          3
Dirk
4 days later
MAB
#
MAB <MichelBeck <at> sbcglobal.Net> writes:

Hi!

When I plot the time-series in a zoo object using plot.zoo they are all drawn 
successively on the same graphics device. If there are more than 10 series 
this is not legible. With the "standard" plot function I could use the 
graphics parameter mfcol or mfrow to specify the number of plot 
screens/pannels per device.

How can I do this with zoo?

Thanks,

Michel

PS How do I open multiple on-screen graphics device at one time to plot a 
large number of time-series? Within a plotting loop an additional device 
should open each time the maximum number of plot screens/pannels specified per 
device is reached?
#
If you want some on one page and others on another page
issue two plot.zoo commands.

plot(z[,1:2])
plot(z[,3:4])

Also look at xyplot.zoo which gives you the facilities of lattice xyplot
with zoo objects.
On Feb 8, 2008 3:15 PM, MAB <MichelBeck at sbcglobal.net> wrote:
#
One other point.

If you only plot a single panel (there can be multiple time series in
each panel)
at a time then you can use mfrow.  For example,  this works:

library(zoo)
opar <- par(mfrow = c(2,2))
z <- zoo(cbind(a = 1:5, b = 2:6, c = 3:7, d = 4:8))

for(cn in colnames(z)) plot(z[, cn], main = cn, ylim = range(z))

par(opar)
On Feb 8, 2008 3:38 PM, Gabor Grothendieck <ggrothendieck at gmail.com> wrote: