Skip to content

Commit

Permalink
version 1.8-12
Browse files Browse the repository at this point in the history
  • Loading branch information
zeileis authored and cran-robot committed Apr 13, 2023
1 parent 4c527f5 commit f01afa0
Show file tree
Hide file tree
Showing 21 changed files with 102 additions and 89 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: zoo
Version: 1.8-11
Date: 2022-09-15
Version: 1.8-12
Date: 2023-04-11
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 @@ -22,12 +22,12 @@ 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-09-15 15:20:12 UTC; zeileis
Packaged: 2023-04-11 21:24:32 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-09-17 19:50:02 UTC
Date/Publication: 2023-04-13 12:13:20 UTC
40 changes: 20 additions & 20 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
947ac1f5bb8a05ca965cd09008ae60bf *DESCRIPTION
20c2a110c3d865ff995f5ecf2815bdc3 *NAMESPACE
ea2937e102ed03cceee16d176772802d *NEWS
a5c47eb23bc05dabcdf9adc0a923c06c *DESCRIPTION
1963cacb92c8f76f0865d00740449c43 *NAMESPACE
0a7679340b7f7c973b81f3bf5b1c86c7 *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
a96668152049b188317455e7cdb61bd7 *R/as.zoo.R
42d2549b937334f78b62e4fb98e7cfa7 *R/as.zoo.R
62c1bf87a7380c654f17b1b8ed71efc6 *R/as.zoo.tis.R
faaae6520bab57abe84eaa00ee3ad414 *R/barplot.zoo.R
5af291cb99c193b4db3fc89ac9a59cff *R/coredata.R
53d1efa0fe09fcd4e6e5d5cdced56502 *R/ggplot2.zoo.R
ccb925c40b1398f7c427b934778d1b91 *R/ggplot2.zoo.R
04a26dde3202887ef53a4b78a8e49830 *R/index.R
e0b9e9a919725d282d7b4e608e42a364 *R/index2char.R
4eb9cb572803b612e1735713d0d4fdce *R/index2char.R
1d215aeb25acc0c75a6321f0522e2a76 *R/is.regular.R
bdb3ac5e66c6b34351c21dba99ca4c51 *R/merge.zoo.R
7564a94e7eb8117617e4433e69f0b50b *R/na.StructTS.R
4e8c25337f2e1891e0939ebf2e6b0138 *R/na.aggregate.R
85d12003737b84bf77301e05e87e5bc0 *R/na.approx.R
824be88c3d276757f34bf4792223a4f6 *R/na.approx.R
4ed0e2f08381ac59978b36893db30e5a *R/na.fill.R
cd801f2e256a937016dfa229969ae118 *R/na.locf.R
7682d00afdbff36fd903883d4df687a3 *R/na.spline.R
Expand All @@ -27,18 +27,18 @@ e1693ddba5cb8a6c55839564b02d80bd *R/na.trim.R
03db77ea299410fa4c573e370ac2cc48 *R/read.zoo.R
f961d86ef885dc7641d30380917b4919 *R/rollapply.R
975b201ae4e5746503ac0fea981e4a4d *R/rollmean.R
4ac2c5e2ce0c7d22b12ed1ffcd5a1b04 *R/window.zoo.R
10144d674a64df659d315a3660b68210 *R/window.zoo.R
f00456b37d08ed0da5cd43756e2cf4ea *R/xblocks.R
e453aed85b5d4c2a69e8bda7a7fb2f0d *R/xyplot.zoo.R
ec1d4ff4cfac5ffdfcededf4c876dd0f *R/yearmon.R
aa3d1814ac79cf44b8c5aa5223f8c3c5 *R/yearqtr.R
0c2817c7040a2d175f2353c2a5342be6 *R/zoo.R
6ce3a445569bd5081a41a2eeca68188e *R/zooreg.R
2384093e877b896e17e0a4db2880d81a *R/zzz.R
34de8b50fe7b4a2bd4d1625599fa3b9c *build/vignette.rds
5dd549a8711e3614dcc034cf8950498f *build/vignette.rds
beb8720082847566abaa78c65ee97815 *demo/00Index
1c04abe2bd67fe9ba55d6e1ac3e73cab *demo/zoo-overplot.R
1148328a784117c9ece85e67e7de3c9d *inst/CITATION
46c8080b0ab7f4edc4b376cdd984329d *inst/CITATION
21bede1b02820b648012773b5d3994fe *inst/THANKS
bdc15aaa93d42a0e813dbca29806940a *inst/TODO
e3acf3d51204abf03613d4db414a318d *inst/WISHLIST
Expand All @@ -48,27 +48,27 @@ a916af484ffa11d8aa8669404a25e53c *inst/doc/demo1.txt
8ab6ae33767b9f99c8158192e12832c1 *inst/doc/sunw.rda
e90680abb6a7cd9bd8de0e07667711b7 *inst/doc/zoo-design.R
5051eb1d34cd0d183e2d84449912c9f8 *inst/doc/zoo-design.Rnw
b1a915b3f49960f42d105ccf55541092 *inst/doc/zoo-design.pdf
0178f6e9cc862e2fb8e34f2ef97fec4a *inst/doc/zoo-design.pdf
f258743c6f42e2f350f04b0a5354fa8b *inst/doc/zoo-faq.R
abeb6951c1dda54c9f394191dee37559 *inst/doc/zoo-faq.Rnw
d7d48b7f805edf18d67db53e0c378a6b *inst/doc/zoo-faq.pdf
670fac6e9b27643a69f290b8f9989734 *inst/doc/zoo-faq.pdf
8d6f657051d84755ac8455ab71a16af1 *inst/doc/zoo-quickref.R
7ff295aaa718852e5e251f350a5fc0ca *inst/doc/zoo-quickref.Rnw
951c99cfe653112084b86c5deb63a0c6 *inst/doc/zoo-quickref.pdf
d42fda16d1377b924073aa7b353e56bf *inst/doc/zoo-quickref.pdf
7d6ae67bb66889b140f813a41de176ca *inst/doc/zoo-read.R
fec411fafcf466d90674fec53e92ff4b *inst/doc/zoo-read.Rnw
78647e88635385643d042ee0ff8b77cd *inst/doc/zoo-read.pdf
cd62f7aa574bda5b3e3b296876dee79b *inst/doc/zoo-read.pdf
429aa6375a73f63cf9fc2ce2e8acbbf5 *inst/doc/zoo.R
4604fde9b40ab9b9c03c5cf6ba4a0939 *inst/doc/zoo.Rnw
86a98694ff7e9c60e2c81d16fea12cf5 *inst/doc/zoo.pdf
b90dc7ce40a04bf042b4bc6a6683156e *inst/doc/zoo.pdf
dd2909911733f11d02837283e885402e *inst/include/zoo.h
049de4bce6d54e1245d1f717d46aa214 *man/MATCH.Rd
ce5614980ae640df7c8388f72de3a0ca *man/ORDER.Rd
bd9c7117b3bc57122236527f00764538 *man/aggregate.zoo.Rd
9f4520c0da898b2c1015214ad0983a09 *man/as.zoo.Rd
e4d5e73b04ea219a68758f5e418cf03d *man/coredata.Rd
a91c3b70c28fc5e49376918e6f963781 *man/frequency.Rd
980badf137220c75b960c11262510dbb *man/ggplot2.zoo.Rd
5065376bc3450e37674ae5c4b78f6980 *man/ggplot2.zoo.Rd
0ee53f3c9dd874f11810b2bf48cd2286 *man/index.Rd
8cf1931a2b0bf69932742baa3888633f *man/is.regular.Rd
c97b5855503b079c6bb4ec2e47764ede *man/lag.zoo.Rd
Expand All @@ -89,14 +89,14 @@ bc80d93adebdb275b6ebea39413a1c14 *man/window.zoo.Rd
fa0c77d6ec2433b0a48a9f6b481b3180 *man/xyplot.zoo.Rd
36fa499dcea3af90e38d99c0006a46ce *man/yearmon.Rd
9f07c8b098764cf10678e2bcccc98afe *man/yearqtr.Rd
386e7670256237cf3e3f0e601419df5c *man/zoo.Rd
5b2bdbe8dafc1f4282c19bcc2e6715b0 *man/zoo.Rd
58ee858545582658d9d7b4f7532b4e7e *man/zooreg.Rd
3f03da795dd26373156bddc78d41e95d *src/Makevars
3f03da795dd26373156bddc78d41e95d *src/Makevars.win
d0497d676c87199bdef94f8f8a7c2dc5 *src/coredata.c
132711221439cc019865622951f728f3 *src/coredata.c
d80f53271535df8c5070377e897052cc *src/init.c
28ea187973338c914a065d7bd1923133 *src/lag.c
b8b5da61bf66a9c5a2c8fe3c8faea58b *tests/Examples/zoo-Ex.Rout.save
91d77ccc8c5941e10405464bce66b4b0 *src/lag.c
5b79779a1a8bde4653841ecdcbf5bea2 *tests/Examples/zoo-Ex.Rout.save
cbea17222fe8d8f0846e1ec28ab2b987 *tests/as.Date.R
1882571886517203f54502bc1f8b3fac *tests/as.Date.Rout.save
3208e41199e2d233f5d1272f58d0fd9f *tests/bugfixes.R
Expand Down
5 changes: 2 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ if(getRversion() >= "3.6.0") {
S3method("as.list", "yearmon")
S3method("as.numeric", "yearmon")
S3method("as.data.frame", "yearmon")
S3method("axis", "yearmon")
S3method("c", "yearmon")
S3method("cycle", "yearmon")
S3method("diff", "yearmon")
Expand Down Expand Up @@ -334,7 +333,6 @@ if(getRversion() >= "3.6.0") {
S3method("as.list", "yearqtr")
S3method("as.numeric", "yearqtr")
S3method("as.data.frame", "yearqtr")
S3method("axis", "yearqtr")
S3method("c", "yearqtr")
S3method("cycle", "yearqtr")
S3method("diff", "yearqtr")
Expand Down Expand Up @@ -369,8 +367,9 @@ if(getRversion() >= "3.6.0") {
S3method("coredata", "default")
S3method("index", "default")
S3method("index2char", "default")
S3method("is.regular", "default")
S3method("index2char", "numeric")
S3method("index2char", "POSIXt")
S3method("is.regular", "default")
S3method("na.approx", "default")
S3method("na.fill", "default")
S3method("na.locf", "default")
Expand Down
16 changes: 16 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
Changes in Version 1.8-12

o The autoplot() method for "zoo" objects now uses ggplot() directly rather
than the qplot() function which has been deprecated in recent versions of
ggplot2.

o Support start = NA and end = NA in addition to start = NULL and end = NULL
for unspecified start and end time of a window() of a zoo series.

o Remove unnecessary S3 method declarations for axis.yearmon/yearqtr as
axis() is no S3 generic, only Axis() is (reported by Kurt Hornik).

o The helper function index2char() now calls format() instead of as.character()
for objects inheriting from class POSIXt.


Changes in Version 1.8-11

o The as.ts() methods for both "zoo" and "zooreg" objects now allow to pass on
Expand Down
2 changes: 1 addition & 1 deletion R/as.zoo.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ as.zoo.timeSeries <- function(x, ...) {

as.zoo.xts <- function(x, ...) {
y <- coredata(x)
if (length(y) == 0) {
if (is.null(dim(y)) && length(y) == 0) {
y <- NULL
}
zoo(y, order.by = index(x), ...)
Expand Down
12 changes: 8 additions & 4 deletions R/ggplot2.zoo.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,20 @@ autoplot.zoo <- function(object, geom = "line", facets, ...)
facets <- if(single) NULL else Series ~ .
} else {
auto <- FALSE
}
}

## process defaults as for old qplot-based interface
if(is.character(geom)) geom <- get(paste0("geom_", geom), asNamespace("ggplot2"))
if(inherits(facets, "formula")) facets <- ggplot2::facet_grid(facets)

## "fake" variables for nonstandard evaluation
Index <- Value <- Series <- NULL

## call qplot
gg <- if(single | (!is.null(facets) & auto)) {
ggplot2::qplot(Index, Value, data = df, geom = geom, facets = facets, ...) + ggplot2::ylab(if(single) levels(df$Series) else "") + ggplot2::xlab("Index")
ggplot2::ggplot(df, ggplot2::aes(x = Index, y = Value, ...)) + geom() + facets + ggplot2::ylab(if(single) levels(df$Series) else "") + ggplot2::xlab("Index")
} else {
ggplot2::qplot(Index, Value, data = df, group = Series, geom = geom, facets = facets, colour = Series, ...) + ggplot2::ylab("") + ggplot2::xlab("Index")
ggplot2::ggplot(df, ggplot2::aes(x = Index, y = Value, group = Series, colour = Series, ...)) + geom() + facets + ggplot2::ylab("") + ggplot2::xlab("Index")
}
return(gg)
}
Expand Down
2 changes: 2 additions & 0 deletions R/index2char.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ index2char <- function(x, ...) UseMethod("index2char")

index2char.default <- function(x, ...) as.character(x)

index2char.POSIXt <- function(x, ...) format(x, ...)

index2char.numeric <- function(x, frequency = NULL, digits = getOption("digits") - 3, ...)
{
freq <- frequency
Expand Down
2 changes: 1 addition & 1 deletion R/na.approx.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ na.approx.zoo <- function(object, x = index(object), xout, ..., na.rm = TRUE, ma
}
objectm <- merge(object.x, zoo(, xout))
if (length(dim(objectm)) == 2) colnames(objectm) <- colnames(object)
result <- window(objectm, index = xout)
result <- window(objectm, index. = xout)
}
result[] <- na.approx.default(object, x = x, xout = xout, na.rm = FALSE, ..., maxgap = maxgap)
if ((!missing(order.by) && !is.null(order.by)) || !missing.xout) {
Expand Down
10 changes: 5 additions & 5 deletions R/window.zoo.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ window.zoo <- function(x, index. = index(x), start = NULL, end = NULL, ...)
end <- floor(end[1]*freq + (end[2] - 1) + .0001)/freq
}

if(is.null(start)) {
if(is.null(end)) {
if(is.null(start) || any(is.na(start))) {
if(is.null(end) || any(is.na(end))) {
wi <- which(MATCH(all.indexes, index., nomatch = 0) > 0)
return(x[wi, , drop = FALSE])
} else {
wi <- which(in.index & all.indexes <= end)
return(x[wi, , drop = FALSE])
}
} else {
if(is.null(end)) {
if(is.null(end) || any(is.na(end))) {
wi <- which(in.index & all.indexes >= start)
} else {
wi <- which(in.index & all.indexes >= start & all.indexes <= end)
Expand All @@ -44,8 +44,8 @@ window.zoo <- function(x, index. = index(x), start = NULL, end = NULL, ...)
end <- floor(end[1]*freq + (end[2] - 1) + .0001)/freq
}

if (!is.null(start)) index. <- index.[index. >= start]
if (!is.null(end)) index. <- index.[index. <= end]
if (!is.null(start) && !is.na(start)) index. <- index.[index. >= start]
if (!is.null(end) && !is.na(end)) index. <- index.[index. <= end]

wi <- which(MATCH(ix, index., nomatch = 0) > 0)
if (length(dim(x)) == 0)
Expand Down
Binary file modified build/vignette.rds
Binary file not shown.
29 changes: 11 additions & 18 deletions inst/CITATION
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
citHeader("To cite zoo in publications use:")

citEntry(entry="Article",
title = "zoo: S3 Infrastructure for Regular and Irregular Time Series",
author = personList(as.person("Achim Zeileis"),
as.person("Gabor Grothendieck")),
journal = "Journal of Statistical Software",
year = "2005",
volume = "14",
number = "6",
pages = "1--27",
doi = "10.18637/jss.v014.i06",

textVersion =
paste("Achim Zeileis and Gabor Grothendieck (2005).",
"zoo: S3 Infrastructure for Regular and Irregular Time Series.",
"Journal of Statistical Software, 14(6), 1-27.",
"doi:10.18637/jss.v014.i06")
bibentry(bibtype = "Article",
title = "zoo: S3 Infrastructure for Regular and Irregular Time Series",
author = c(person(given = "Achim", family = "Zeileis"),
person(given = "Gabor", family = "Grothendieck")),
journal = "Journal of Statistical Software",
year = "2005",
volume = "14",
number = "6",
pages = "1--27",
doi = "10.18637/jss.v014.i06",
header = "To cite zoo in publications use:"
)
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.
23 changes: 11 additions & 12 deletions man/ggplot2.zoo.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@

\arguments{
\item{object}{an object of class \code{"zoo"}.}
\item{geom}{character specifying which \code{geom} to use
in \code{\link[ggplot2]{qplot}}.}
\item{facets}{specification of \code{facets} for \code{\link[ggplot2]{qplot}}. The
\item{geom}{character (e.g., \code{"line"}) or function (e.g., \code{\link[ggplot2]{geom_line}})
specifying which \code{geom} to use.}
\item{facets}{specification of \code{facets} for \code{\link[ggplot2]{facet_grid}}. The
default in the \code{autoplot} method is to use \code{facets = NULL} for univariate
series and \code{facets = Series ~ .} for multivariate series.}
\item{\dots}{further arguments passed to \code{\link[ggplot2]{qplot}}
for \code{autoplot} (and not used for \code{fortify}). For the \code{scale_*_*}
\item{\dots}{further arguments passed to \code{\link[ggplot2]{aes}}
for \code{autoplot} (e.g., \code{linetype = Series} and/or \code{shape = Series}).
For \code{fortify} the arguments are not used. For the \code{scale_*_*}
functions the arguments are passed on to \code{scale_*_continuous}.}
\item{model}{an object of class \code{"zoo"} to be converted to
a \code{"data.frame"}.}
Expand All @@ -69,8 +70,7 @@
\code{fortify.zoo} takes a zoo object and converts it into a data frame
(intended for ggplot2). \code{autoplot.zoo} takes a zoo object and returns a
ggplot2 object. It essentially uses the mapping \code{aes(x = Time, y = Value, group = Series)}
and adds \code{colour = Series}, \code{linetype = Series}, \code{shape = Series}
in the case of a multivariate series with \code{facets = NULL}.
and adds \code{colour = Series} in the case of a multivariate series with \code{facets = NULL}.
}

\value{
Expand All @@ -89,7 +89,7 @@
}

\seealso{
\code{\link[ggplot2]{autoplot}}, \code{\link[ggplot2]{fortify}}, \code{\link[ggplot2]{qplot}}
\code{\link[ggplot2]{autoplot}}, \code{\link[ggplot2]{fortify}}, \code{\link[ggplot2]{ggplot}}
}

\examples{
Expand Down Expand Up @@ -120,11 +120,10 @@ autoplot(z) ## multiple without color/linetype
autoplot(z, facets = Series ~ .) ## multiple with series-dependent color/linetype
autoplot(z, facets = NULL) ## single with series-dependent color/linetype
## by hand with color/linetype and with/without facets
qplot(x = Index, y = Value, group = Series, colour = Series,
linetype = Series, facets = Series ~ ., data = fortify(z, melt = TRUE)) +
geom_line() + xlab("Index") + ylab("")
ggplot(aes(x = Index, y = Value, group = Series, colour = Series, linetype = Series),
ggz <- ggplot(aes(x = Index, y = Value, group = Series, colour = Series, linetype = Series),
data = fortify(z, melt = TRUE)) + geom_line() + xlab("Index") + ylab("")
ggz
ggz + facet_grid(Series ~ .)
## variations
autoplot(z, geom = "point")
autoplot(z, facets = NULL) + geom_point()
Expand Down
1 change: 1 addition & 0 deletions man/zoo.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
\alias{index2char}
\alias{index2char.default}
\alias{index2char.numeric}
\alias{index2char.POSIXt}

\alias{head.ts}
\alias{tail.ts}
Expand Down
14 changes: 7 additions & 7 deletions src/coredata.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ SEXP zoo_coredata (SEXP x, SEXP copyAttr)
removing
*/
SEXP result;
int i, j, ncs, nrs;
R_xlen_t i, j, ncs, nrs;
int P=0;
PROTECT(result = allocVector(TYPEOF(x), length(x))); P++;
PROTECT(result = allocVector(TYPEOF(x), xlength(x))); P++;
switch( TYPEOF(x)) {
case REALSXP:
memcpy(REAL(result), REAL(x), length(result) * sizeof(double));
memcpy(REAL(result), REAL(x), xlength(result) * sizeof(double));
break;
case INTSXP:
memcpy(INTEGER(result), INTEGER(x), length(result) * sizeof(int));
memcpy(INTEGER(result), INTEGER(x), xlength(result) * sizeof(int));
break;
case LGLSXP:
memcpy(LOGICAL(result), LOGICAL(x), length(result) * sizeof(int));
memcpy(LOGICAL(result), LOGICAL(x), xlength(result) * sizeof(int));
break;
case CPLXSXP:
memcpy(COMPLEX(result), COMPLEX(x), length(result) * sizeof(Rcomplex));
memcpy(COMPLEX(result), COMPLEX(x), xlength(result) * sizeof(Rcomplex));
break;
case STRSXP:
ncs = ncols(x); nrs = nrows(x);
Expand All @@ -55,7 +55,7 @@ SEXP zoo_coredata (SEXP x, SEXP copyAttr)
SET_STRING_ELT(result, i+j*nrs, STRING_ELT(x, i+j*nrs));
break;
case RAWSXP:
memcpy(RAW(result), RAW(x), length(result) * sizeof(unsigned char));
memcpy(RAW(result), RAW(x), xlength(result) * sizeof(unsigned char));
break;
default:
error("currently unsupported data type");
Expand Down
Loading

0 comments on commit f01afa0

Please sign in to comment.