Skip to content

Commit

Permalink
version 1.8-11
Browse files Browse the repository at this point in the history
  • Loading branch information
zeileis authored and cran-robot committed Sep 17, 2022
1 parent 17432a9 commit 4c527f5
Show file tree
Hide file tree
Showing 18 changed files with 121 additions and 52 deletions.
10 changes: 5 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: zoo
Version: 1.8-10
Date: 2022-04-15
Version: 1.8-11
Date: 2022-09-15
Title: S3 Infrastructure for Regular and Irregular Time Series (Z's
Ordered Observations)
Authors@R: c(person(given = "Achim", family = "Zeileis", role = c("aut", "cre"), email = "[email protected]",
Expand All @@ -16,18 +16,18 @@ Description: An S3 class with methods for totally ordered indexed
consistency with ts and base R by providing methods to extend
standard generics.
Depends: R (>= 3.1.0), stats
Suggests: AER, coda, chron, fts, ggplot2 (>= 3.0.0), mondate, scales,
Suggests: AER, coda, chron, ggplot2 (>= 3.0.0), mondate, scales,
stinepack, strucchange, timeDate, timeSeries, tis, tseries, xts
Imports: utils, graphics, grDevices, lattice (>= 0.20-27)
License: GPL-2 | GPL-3
URL: https://zoo.R-Forge.R-project.org/
NeedsCompilation: yes
Packaged: 2022-04-15 11:09:52 UTC; zeileis
Packaged: 2022-09-15 15:20:12 UTC; zeileis
Author: Achim Zeileis [aut, cre] (<https://orcid.org/0000-0003-0918-3766>),
Gabor Grothendieck [aut],
Jeffrey A. Ryan [aut],
Joshua M. Ulrich [ctb],
Felix Andrews [ctb]
Maintainer: Achim Zeileis <[email protected]>
Repository: CRAN
Date/Publication: 2022-04-15 12:50:02 UTC
Date/Publication: 2022-09-17 19:50:02 UTC
34 changes: 17 additions & 17 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
81c1006461e64232054aaa87cf5d100b *DESCRIPTION
1ce3538f672f00a53c0771e0379b72d9 *NAMESPACE
3b9710b00b03b65260f7cae6225292b7 *NEWS
ea76d9b3042c953958c709e6fc260b21 *R/MATCH.R
947ac1f5bb8a05ca965cd09008ae60bf *DESCRIPTION
20c2a110c3d865ff995f5ecf2815bdc3 *NAMESPACE
ea2937e102ed03cceee16d176772802d *NEWS
7ecaff55c2ae98b77d24c4b6c7f7cf86 *R/MATCH.R
3eebd5fe3394080789fedfea3a45e3ab *R/ORDER.R
9015ff069b28219b6dc44505641d249c *R/Ops.zoo.R
5c3f54c4c9d2692046b3b1049fc771f8 *R/aggregate.zoo.R
65b001243ba9e0edf4c03e60bad35129 *R/as.Date.R
93ff2d240541d0aa3588d410eb235699 *R/as.Date.ts.R
4535d50f3cf3b0bb895835ef581544e2 *R/as.zoo.R
a96668152049b188317455e7cdb61bd7 *R/as.zoo.R
62c1bf87a7380c654f17b1b8ed71efc6 *R/as.zoo.tis.R
faaae6520bab57abe84eaa00ee3ad414 *R/barplot.zoo.R
5af291cb99c193b4db3fc89ac9a59cff *R/coredata.R
53d1efa0fe09fcd4e6e5d5cdced56502 *R/ggplot2.zoo.R
04a26dde3202887ef53a4b78a8e49830 *R/index.R
e0b9e9a919725d282d7b4e608e42a364 *R/index2char.R
1d215aeb25acc0c75a6321f0522e2a76 *R/is.regular.R
ff086d535663fce6bd2411beb37ca840 *R/merge.zoo.R
bdb3ac5e66c6b34351c21dba99ca4c51 *R/merge.zoo.R
7564a94e7eb8117617e4433e69f0b50b *R/na.StructTS.R
4e8c25337f2e1891e0939ebf2e6b0138 *R/na.aggregate.R
85d12003737b84bf77301e05e87e5bc0 *R/na.approx.R
Expand All @@ -35,7 +35,7 @@ aa3d1814ac79cf44b8c5aa5223f8c3c5 *R/yearqtr.R
0c2817c7040a2d175f2353c2a5342be6 *R/zoo.R
6ce3a445569bd5081a41a2eeca68188e *R/zooreg.R
2384093e877b896e17e0a4db2880d81a *R/zzz.R
32d40cc1ea29526444f3cbac32707673 *build/vignette.rds
34de8b50fe7b4a2bd4d1625599fa3b9c *build/vignette.rds
beb8720082847566abaa78c65ee97815 *demo/00Index
1c04abe2bd67fe9ba55d6e1ac3e73cab *demo/zoo-overplot.R
1148328a784117c9ece85e67e7de3c9d *inst/CITATION
Expand All @@ -48,32 +48,32 @@ a916af484ffa11d8aa8669404a25e53c *inst/doc/demo1.txt
8ab6ae33767b9f99c8158192e12832c1 *inst/doc/sunw.rda
e90680abb6a7cd9bd8de0e07667711b7 *inst/doc/zoo-design.R
5051eb1d34cd0d183e2d84449912c9f8 *inst/doc/zoo-design.Rnw
72f0f847d9b4af4187cf677bc336eba6 *inst/doc/zoo-design.pdf
b1a915b3f49960f42d105ccf55541092 *inst/doc/zoo-design.pdf
f258743c6f42e2f350f04b0a5354fa8b *inst/doc/zoo-faq.R
abeb6951c1dda54c9f394191dee37559 *inst/doc/zoo-faq.Rnw
99d7ca08ee1abd5fef67df6361920595 *inst/doc/zoo-faq.pdf
d7d48b7f805edf18d67db53e0c378a6b *inst/doc/zoo-faq.pdf
8d6f657051d84755ac8455ab71a16af1 *inst/doc/zoo-quickref.R
7ff295aaa718852e5e251f350a5fc0ca *inst/doc/zoo-quickref.Rnw
650daf9e313b330e1f216c512c842ff1 *inst/doc/zoo-quickref.pdf
951c99cfe653112084b86c5deb63a0c6 *inst/doc/zoo-quickref.pdf
7d6ae67bb66889b140f813a41de176ca *inst/doc/zoo-read.R
fec411fafcf466d90674fec53e92ff4b *inst/doc/zoo-read.Rnw
93f47b7fbe45992d45f6d369c6efd403 *inst/doc/zoo-read.pdf
78647e88635385643d042ee0ff8b77cd *inst/doc/zoo-read.pdf
429aa6375a73f63cf9fc2ce2e8acbbf5 *inst/doc/zoo.R
4604fde9b40ab9b9c03c5cf6ba4a0939 *inst/doc/zoo.Rnw
b34dc81cad92fa5aa66d952eef1863a6 *inst/doc/zoo.pdf
86a98694ff7e9c60e2c81d16fea12cf5 *inst/doc/zoo.pdf
dd2909911733f11d02837283e885402e *inst/include/zoo.h
b9399dea40883cbabe28389558bea5b1 *man/MATCH.Rd
049de4bce6d54e1245d1f717d46aa214 *man/MATCH.Rd
ce5614980ae640df7c8388f72de3a0ca *man/ORDER.Rd
bd9c7117b3bc57122236527f00764538 *man/aggregate.zoo.Rd
bfce0d8c8e78e8a3e98a6ea0aad69812 *man/as.zoo.Rd
9f4520c0da898b2c1015214ad0983a09 *man/as.zoo.Rd
e4d5e73b04ea219a68758f5e418cf03d *man/coredata.Rd
a91c3b70c28fc5e49376918e6f963781 *man/frequency.Rd
980badf137220c75b960c11262510dbb *man/ggplot2.zoo.Rd
0ee53f3c9dd874f11810b2bf48cd2286 *man/index.Rd
8cf1931a2b0bf69932742baa3888633f *man/is.regular.Rd
c97b5855503b079c6bb4ec2e47764ede *man/lag.zoo.Rd
2a40905ca067abf2ac4b679c6e12748a *man/make.par.list.Rd
d45095920bd9e49e255a2748b69fb79d *man/merge.zoo.Rd
dc7286f51c24a054340cff7da720db28 *man/merge.zoo.Rd
3c0fb563ffd6d9c834a2bea15add16e4 *man/na.StructTS.Rd
d2c2255460d224a4a7c332f5c03cce4c *man/na.aggregate.Rd
12a2b5866170ca6d3266eb04909ee844 *man/na.approx.Rd
Expand All @@ -87,7 +87,7 @@ a01d3360c362844e5670fc6eac28e333 *man/rollapply.Rd
bc80d93adebdb275b6ebea39413a1c14 *man/window.zoo.Rd
1b447893b54d8ec70f5b7d1bd3b7d73c *man/xblocks.Rd
fa0c77d6ec2433b0a48a9f6b481b3180 *man/xyplot.zoo.Rd
864cec5d337783fb997e2b31a45ad054 *man/yearmon.Rd
36fa499dcea3af90e38d99c0006a46ce *man/yearmon.Rd
9f07c8b098764cf10678e2bcccc98afe *man/yearqtr.Rd
386e7670256237cf3e3f0e601419df5c *man/zoo.Rd
58ee858545582658d9d7b4f7532b4e7e *man/zooreg.Rd
Expand All @@ -96,7 +96,7 @@ fa0c77d6ec2433b0a48a9f6b481b3180 *man/xyplot.zoo.Rd
d0497d676c87199bdef94f8f8a7c2dc5 *src/coredata.c
d80f53271535df8c5070377e897052cc *src/init.c
28ea187973338c914a065d7bd1923133 *src/lag.c
5e203557161737c61293cd0e3f29e2ba *tests/Examples/zoo-Ex.Rout.save
b8b5da61bf66a9c5a2c8fe3c8faea58b *tests/Examples/zoo-Ex.Rout.save
cbea17222fe8d8f0846e1ec28ab2b987 *tests/as.Date.R
1882571886517203f54502bc1f8b3fac *tests/as.Date.Rout.save
3208e41199e2d233f5d1272f58d0fd9f *tests/bugfixes.R
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ if(getRversion() >= "3.6.0") {
S3method("is.regular", "ts")
S3method("na.approx", "ts")
S3method("na.fill", "ts")
S3method("na.spline", "ts")
S3method("na.StructTS", "ts")
S3method("na.trim", "ts")
S3method("rollapply", "ts")
Expand Down
27 changes: 27 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
Changes in Version 1.8-11

o The as.ts() methods for both "zoo" and "zooreg" objects now allow to pass on
the fill argument (through ...) to the underlying merge() call. Thus, you can
say as.ts(z, fill = 0) to fill potential gaps with 0s instead of NAs.

o The na.spline() method for "ts" objects had been provided internally in the
package but has only been correctly registered in the NAMESPACE now.

o The merge() method gained a sep = "." argument to optionally use a different
separator character when making pasting suffixes to column names for making
them unique (suggested by Joshua Ulrich).

o The MATCH() methods for Date/POSIXct/POSIXlt object now coerce the "table"
argument (if necessary) to Date or POSIXct, respectively, before calling
match(unclass(x), unclass(table), ...) internally.

o In case of a Date/POSIXct/POSIXlt "table" and a plain atomic argument "x",
the default MATCH() method coerces "x" to Date or POSIXct, respectively,
before calling match(unclass(x), unclass(table), ...) internally.

o As the "fts" package has been archived on CRAN for several months, it has been
excluded from the Suggests of the package. The as.zoo() method for "fts"
objects continues to be part of the package, though, just the hyperlinks in
the documentation have been removed.


Changes in Version 1.8-10

o The transform() method now internally uses a list of zoo series (as opposed
Expand Down
18 changes: 14 additions & 4 deletions R/MATCH.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
MATCH <- function(x, table, nomatch = NA, ...)
UseMethod("MATCH")

MATCH.default <- function(x, table, nomatch = NA, ...)
MATCH.default <- function(x, table, nomatch = NA, ...) {
if(is.atomic(x) && !is.object(x)) {
if(inherits(table, "Date")) {
x <- unclass(as.Date(x, origin = "1970-01-01"))
table <- unclass(table)
} else if(inherits(table, "POSIXt")) {
x <- unclass(as.POSIXct(x, origin = "1970-01-01"))
table <- unclass(as.POSIXct(table))
}
}
match(x, table, nomatch = nomatch, ...)
}

MATCH.timeDate <- function(x, table, nomatch = NA, ...) {
match(as.POSIXct(x), as.POSIXct(table), nomatch = nomatch, ...)
Expand All @@ -13,17 +23,17 @@ MATCH.times <- function(x, table, nomatch = NA, units = "sec", eps = 1e-10, ...)
}

MATCH.Date <- function(x, table, nomatch = NA, ...) {
if(is.character(table)) table <- as.Date(table)
if(!inherits(table, "Date")) table <- as.Date(table)
match(unclass(x), unclass(table), nomatch = nomatch, ...)
}

MATCH.POSIXct <- function(x, table, nomatch = NA, ...) {
if(is.character(table)) table <- as.POSIXct(table)
if(!inherits(table, "POSIXct")) table <- as.POSIXct(table)
match(unclass(x), unclass(table), nomatch = nomatch, ...)
}

MATCH.POSIXlt <- function(x, table, nomatch = NA, ...) {
x <- as.POSIXct(x)
if(inherits(table, "POSIXlt") || is.character(table)) table <- as.POSIXct(table)
if(!inherits(table, "POSIXct")) table <- as.POSIXct(table)
match(unclass(x), unclass(table), nomatch = nomatch, ...)
}
6 changes: 4 additions & 2 deletions R/as.zoo.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,17 @@ as.ts.zooreg <- function(x, ...)
}
tt <- round.(tt)
tt2 <- round.(seq(head(tt,1), tail(tt,1), deltat))
xx <- merge(zoo(coredata(x), tt), zoo(, tt2))
fill <- list(...)$fill
if(is.null(fill)) fill <- NA
xx <- merge(zoo(coredata(x), tt), zoo(, tt2), fill = fill)
ts(coredata(xx), start = tt[1], frequency = freq)
}

as.ts.zoo <- function(x, ...)
{
if(is.regular(x)) {
attr(x, "frequency") <- frequency(x)
return(as.ts.zooreg(x))
return(as.ts.zooreg(x, ...))
} else {
warning(paste(sQuote("x"), "does not have an underlying regularity"))
return(ts(coredata(x)))
Expand Down
16 changes: 8 additions & 8 deletions R/merge.zoo.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,18 @@ c.zoo <- function(...) {
rbind.zoo(...)
}

cbind.zoo <- function(..., all = TRUE, fill = NA, suffixes = NULL, drop = FALSE)
cbind.zoo <- function(..., all = TRUE, fill = NA, suffixes = NULL, drop = FALSE, sep = ".")
{
merge.zoo(..., all = all, fill = fill, suffixes = suffixes, retclass = "zoo", drop = drop)
merge.zoo(..., all = all, fill = fill, suffixes = suffixes, retclass = "zoo", drop = drop, sep = sep)
}


merge.zoo <- function(..., all = TRUE, fill = NA, suffixes = NULL, check.names = FALSE, retclass = c("zoo", "list", "data.frame"), drop = TRUE)
merge.zoo <- function(..., all = TRUE, fill = NA, suffixes = NULL, check.names = FALSE, retclass = c("zoo", "list", "data.frame"), drop = TRUE, sep = ".")
{
if (!is.null(retclass)) retclass <- match.arg(retclass)
# cl are calls to the args and args is a list of the arguments
cl <- as.list(match.call())
cl[[1]] <- cl$all <- cl$fill <- cl$retclass <- cl$suffixes <- cl$check.names <- cl$drop <- NULL
cl[[1]] <- cl$all <- cl$fill <- cl$retclass <- cl$suffixes <- cl$check.names <- cl$drop <- cl$sep <- NULL
args <- list(...)

parent <- parent.frame()
Expand Down Expand Up @@ -293,7 +293,7 @@ merge.zoo <- function(..., all = TRUE, fill = NA, suffixes = NULL, check.names =
rval <- lapply(rval, todf)
## name processing
nam2 <- sapply(rval, function(z) 1:NCOL(z))
for(i in 1:length(nam2)) nam2[[i]] <- paste(names(nam2)[i], nam2[[i]], sep = ".")
for(i in 1:length(nam2)) nam2[[i]] <- paste(names(nam2)[i], nam2[[i]], sep = sep)
nam1 <- unlist(ifelse(sapply(rval, NCOL) > 1, nam2, nam1))
rval <- do.call("cbind", rval)
names(rval) <- nam1
Expand Down Expand Up @@ -331,7 +331,7 @@ merge.zoo <- function(..., all = TRUE, fill = NA, suffixes = NULL, check.names =
if (ncol(a) == 0) return(NULL)
rval <- colnames(a)
if (is.null(rval)) {
rval <- paste(1:NCOL(a), suffixes[i], sep = ".")
rval <- paste(1:NCOL(a), suffixes[i], sep = sep)
}
else {
rval[rval == ""] <- as.character(which(rval == ""))
Expand All @@ -349,7 +349,7 @@ merge.zoo <- function(..., all = TRUE, fill = NA, suffixes = NULL, check.names =
}
zoocolnames <- lapply(seq_along(args), f)
f <- function(i) ifelse(fixme[[i]], paste(zoocolnames[[i]],
suffixes[i], sep = "."), zoocolnames[[i]])
suffixes[i], sep = sep), zoocolnames[[i]])
if (any(duplicated(unlist(zoocolnames))))
zoocolnames <- lapply(seq_along(args), f)
} else {
Expand All @@ -358,7 +358,7 @@ merge.zoo <- function(..., all = TRUE, fill = NA, suffixes = NULL, check.names =
return(NULL)
if (NCOL(a) < 2)
return("")
else return(paste(".", 1:NCOL(a), sep = ""))
else return(paste(sep, 1:NCOL(a), sep = ""))
}
zoocolnames <- lapply(args, fixcolnames)
zoocolnames <- lapply(seq_along(args), function(i)
Expand Down
Binary file modified build/vignette.rds
Binary file not shown.
Binary file modified inst/doc/zoo-design.pdf
Binary file not shown.
Binary file modified inst/doc/zoo-faq.pdf
Binary file not shown.
Binary file modified inst/doc/zoo-quickref.pdf
Binary file not shown.
Binary file modified inst/doc/zoo-read.pdf
Binary file not shown.
Binary file modified inst/doc/zoo.pdf
Binary file not shown.
18 changes: 16 additions & 2 deletions man/MATCH.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
\alias{MATCH}
\alias{MATCH.default}
\alias{MATCH.times}
\alias{MATCH.timeDate}
\alias{MATCH.Date}
\alias{MATCH.POSIXct}
\alias{MATCH.POSIXlt}

\title{Value Matching}

\description{
\code{MATCH} is a generic function for value matching.
}
Expand All @@ -24,8 +30,16 @@ MATCH(x, table, nomatch = NA, \dots)
\details{
\code{MATCH} is a new generic function which aims at providing
the functionality of the non-generic base function \code{\link[base]{match}}
for arbitrary objects. Currently, there is only a default method which
simply calls \code{\link[base]{match}}.
for arbitrary objects. Currently, there is a default method which
simply calls \code{\link[base]{match}} and various methods for time/date
objects.

The \code{MATCH} method for \code{Date} objects coerces the \code{table}
to \code{Date} as well (if necessary) and then uses
\code{match(unclass(x), unclass(table), ...}. Similarly, the \code{MATCH}
methods for \code{POSIXct}, \code{POSIXlt}, and \code{timeDate} coerce
both \code{x} and \code{table} to \code{POSIXct} and then match the unclassed
objects.

\code{MATCH.times} is used for \code{chron} objects. \code{x} will
match any time in \code{table} less than \code{units} away.
Expand Down
4 changes: 2 additions & 2 deletions man/as.zoo.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ as.zoo(x, \dots)

\details{
\code{as.zoo} currently has a default method and methods for \code{\link{ts}},
\code{\link[fts]{fts}}, \code{\link[tseries]{irts}},
\code{fts} (currently archived on CRAN), \code{\link[tseries]{irts}},
\code{\link[coda]{mcmc}}, \code{\link[tis]{tis}}, \code{\link[xts]{xts}}
objects (and \code{\link{zoo}} objects themselves).

Expand All @@ -55,7 +55,7 @@ always used.

\seealso{\code{\link{zoo}}, \code{\link{fortify.zoo}},
\code{\link{zooreg}}, \code{\link{ts}}, \code{\link[tseries]{irts}},
\code{\link[tis]{tis}}, \code{\link[fts]{fts}}, \code{\link[coda]{mcmc}},
\code{\link[tis]{tis}}, \code{\link[coda]{mcmc}},
\code{\link[xts]{xts}}.
}

Expand Down
4 changes: 3 additions & 1 deletion man/merge.zoo.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ versions of database \emph{join} operations.
\usage{
\method{merge}{zoo}(\dots, all = TRUE, fill = NA, suffixes = NULL,
check.names = FALSE, retclass = c("zoo", "list", "data.frame"),
drop = TRUE)
drop = TRUE, sep = ".")
}

\arguments{
Expand All @@ -33,6 +33,8 @@ versions of database \emph{join} operations.
matrix), should the result be a vector (\code{drop = TRUE}) or a
1-column matrix (\code{drop = FALSE})? The former is the default
in the \code{Merge} method, the latter in the \code{cbind} method.}
\item{sep}{character. Separator character that should be used when
pasting \code{suffixes} to column names for making them unique.}
}

\details{
Expand Down
8 changes: 7 additions & 1 deletion man/yearmon.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,13 @@ next.month <- function(d) as.Date(as.yearmon(d) + 1/12) +
next.month(d)

# 3rd Friday in last month of the quarter of Date x
as.Date(as.yearmon(as.yearqtr(x)) + 2/12) + 14
## first day of last month of quarter
y <- as.Date(zoo::as.yearmon(zoo::as.yearqtr(x), frac = 1))
## number of days to first Friday
n <- sapply(y, function(z) which(format(z + 0:6, "\%w") == "5")) - 1
## add number of days to third Friday
y + n + 14


suppressWarnings(RNGversion("3.5.0"))
set.seed(1)
Expand Down
Loading

0 comments on commit 4c527f5

Please sign in to comment.