| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/zoo.R |
| 3 |
\name{tidy.zoo} |
| 4 |
\alias{tidy.zoo} |
| 5 |
\alias{zoo_tidiers} |
| 6 |
\title{Tidy a(n) zoo object} |
| 7 |
\usage{ |
| 8 |
\method{tidy}{zoo}(x, ...) |
| 9 |
} |
| 10 |
\arguments{ |
| 11 |
\item{x}{A \code{zoo} object such as those created by \code{\link[zoo:zoo]{zoo::zoo()}}.} |
| 12 |
|
| 13 |
\item{...}{Additional arguments. Not used. Needed to match generic |
| 14 |
signature only. \strong{Cautionary note:} Misspelled arguments will be |
| 15 |
absorbed in \code{...}, where they will be ignored. If the misspelled |
| 16 |
argument has a default value, the default value will be used. |
| 17 |
For example, if you pass \code{conf.lvel = 0.9}, all computation will |
| 18 |
proceed using \code{conf.level = 0.95}. Two exceptions here are: |
| 19 |
\itemize{ |
| 20 |
\item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if |
| 21 |
it will be ignored. |
| 22 |
\item \code{augment()} methods will warn when supplied a \code{newdata} argument if it |
| 23 |
will be ignored. |
| 24 |
}} |
| 25 |
} |
| 26 |
\description{ |
| 27 |
Tidy summarizes information about the components of a model. |
| 28 |
A model component might be a single term in a regression, a single |
| 29 |
hypothesis, a cluster, or a class. Exactly what tidy considers to be a |
| 30 |
model component varies across models but is usually self-evident. |
| 31 |
If a model has several distinct types of components, you will need to |
| 32 |
specify which components to return. |
| 33 |
} |
| 34 |
\examples{ |
| 35 |
\dontshow{if (rlang::is_installed(c("zoo", "ggplot2"))) withAutoprint(\{ # examplesIf} |
| 36 |
|
| 37 |
# load libraries for models and data |
| 38 |
library(zoo) |
| 39 |
library(ggplot2) |
| 40 |
|
| 41 |
set.seed(1071) |
| 42 |
|
| 43 |
# generate data |
| 44 |
Z.index <- as.Date(sample(12450:12500, 10)) |
| 45 |
Z.data <- matrix(rnorm(30), ncol = 3) |
| 46 |
colnames(Z.data) <- c("Aa", "Bb", "Cc") |
| 47 |
Z <- zoo(Z.data, Z.index) |
| 48 |
|
| 49 |
# summarize model fit with tidiers + visualization |
| 50 |
tidy(Z) |
| 51 |
|
| 52 |
ggplot(tidy(Z), aes(index, value, color = series)) + |
| 53 |
geom_line() |
| 54 |
|
| 55 |
ggplot(tidy(Z), aes(index, value)) + |
| 56 |
geom_line() + |
| 57 |
facet_wrap(~series, ncol = 1) |
| 58 |
|
| 59 |
Zrolled <- rollmean(Z, 5) |
| 60 |
ggplot(tidy(Zrolled), aes(index, value, color = series)) + |
| 61 |
geom_line() |
| 62 |
\dontshow{\}) # examplesIf} |
| 63 |
} |
| 64 |
\seealso{ |
| 65 |
\code{\link[=tidy]{tidy()}}, \code{\link[zoo:zoo]{zoo::zoo()}} |
| 66 |
|
| 67 |
Other time series tidiers: |
| 68 |
\code{\link{tidy.acf}()}, |
| 69 |
\code{\link{tidy.spec}()}, |
| 70 |
\code{\link{tidy.ts}()} |
| 71 |
} |
| 72 |
\concept{time series tidiers} |
| 73 |
\value{ |
| 74 |
A \code{\link[tibble:tibble]{tibble::tibble()}} with columns: |
| 75 |
\item{index}{Index (i.e. date or time) for a `ts` or `zoo` object.} |
| 76 |
\item{series}{Name of the series (present only for multivariate time series).} |
| 77 |
\item{value}{The value/estimate of the component. Results from data reshaping.} |
| 78 |
|
| 79 |
} |