diff --git a/NAMESPACE b/NAMESPACE index 4f9b8151..eb88c7a4 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -8,10 +8,15 @@ S3method(as_epi_df,tbl_df) S3method(as_epi_df,tbl_ts) S3method(as_tibble,epi_df) S3method(as_tsibble,epi_df) +S3method(autoplot,epi_df) S3method(dplyr_col_modify,col_modify_recorder_df) S3method(dplyr_col_modify,epi_df) S3method(dplyr_reconstruct,epi_df) S3method(dplyr_row_slice,epi_df) +S3method(epi_keys,data.frame) +S3method(epi_keys,default) +S3method(epi_keys,epi_archive) +S3method(epi_keys,epi_df) S3method(epix_truncate_versions_after,epi_archive) S3method(epix_truncate_versions_after,grouped_epi_archive) S3method(group_by,epi_archive) @@ -33,11 +38,13 @@ export(arrange) export(as_epi_archive) export(as_epi_df) export(as_tsibble) +export(autoplot) export(detect_outlr) export(detect_outlr_rm) export(detect_outlr_stl) export(epi_archive) export(epi_cor) +export(epi_keys) export(epi_slide) export(epix_as_of) export(epix_merge) @@ -85,6 +92,7 @@ importFrom(dplyr,rename) importFrom(dplyr,select) importFrom(dplyr,slice) importFrom(dplyr,ungroup) +importFrom(ggplot2,autoplot) importFrom(lubridate,days) importFrom(lubridate,weeks) importFrom(magrittr,"%>%") diff --git a/man/autoplot.epi_df.Rd b/man/autoplot.epi_df.Rd new file mode 100644 index 00000000..134a83fe --- /dev/null +++ b/man/autoplot.epi_df.Rd @@ -0,0 +1,54 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/autoplot.R +\name{autoplot.epi_df} +\alias{autoplot.epi_df} +\title{Automatically plot an epi_df} +\usage{ +\method{autoplot}{epi_df}( + object, + ..., + .color_by = c("all_keys", "geo_value", "other_keys", ".response", "all", "none"), + .facet_by = c(".response", "other_keys", "all_keys", "geo_value", "all", "none"), + .base_color = "#3A448F", + .max_facets = Inf +) +} +\arguments{ +\item{object}{An \code{epi_df}} + +\item{...}{<\code{\link[=dplyr_tidy_select]{tidy-select}}> One or more unquoted +expressions separated by commas. Variable names can be used as if they +were positions in the data frame, so expressions like \code{x:y} can +be used to select a range of variables.} + +\item{.color_by}{Which variables should determine the color(s) used to plot +lines. Options include: +\itemize{ +\item \code{all_keys} - the default uses the interaction of any key variables +including the \code{geo_value} +\item \code{geo_value} - \code{geo_value} only +\item \code{other_keys} - any available keys that are not \code{geo_value} +\item \code{.response} - the numeric variables (same as the y-axis) +\item \code{all} - uses the interaction of all keys and numeric variables +\item \code{none} - no coloring aesthetic is applied +}} + +\item{.facet_by}{Similar to \code{.color_by} except that the default is to display +each numeric variable on a separate facet} + +\item{.base_color}{Lines will be shown with this color. For example, with a +single numeric variable and faceting by \code{geo_value}, all locations would +share the same color line.} + +\item{.max_facets}{Cut down of the number of facets displayed. Especially +useful for testing when there are many \code{geo_value}'s or keys.} +} +\description{ +Automatically plot an epi_df +} +\examples{ +autoplot(jhu_csse_daily_subset, cases, death_rate_7d_av) +autoplot(jhu_csse_daily_subset, case_rate_7d_av, .facet_by = "geo_value") +autoplot(jhu_csse_daily_subset, case_rate_7d_av, .color_by = "none", + .facet_by = "geo_value") +} diff --git a/man/epi_keys.Rd b/man/epi_keys.Rd new file mode 100644 index 00000000..8026fc14 --- /dev/null +++ b/man/epi_keys.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/epi_keys.R +\name{epi_keys} +\alias{epi_keys} +\title{Grab any keys associated to an epi_df} +\usage{ +epi_keys(x, ...) +} +\arguments{ +\item{x}{a data.frame, tibble, or epi_df} + +\item{...}{additional arguments passed on to methods} +} +\value{ +If an \code{epi_df}, this returns all "keys". Otherwise \code{NULL} +} +\description{ +Grab any keys associated to an epi_df +} +\keyword{internal} diff --git a/man/reexports.Rd b/man/reexports.Rd index 46e961d9..fdda2925 100644 --- a/man/reexports.Rd +++ b/man/reexports.Rd @@ -14,6 +14,7 @@ \alias{rename} \alias{slice} \alias{unnest} +\alias{autoplot} \title{Objects exported from other packages} \keyword{internal} \description{ @@ -23,6 +24,8 @@ below to see their documentation. \describe{ \item{dplyr}{\code{\link[dplyr]{arrange}}, \code{\link[dplyr]{filter}}, \code{\link[dplyr]{group_by}}, \code{\link[dplyr:group_map]{group_modify}}, \code{\link[dplyr]{mutate}}, \code{\link[dplyr]{relocate}}, \code{\link[dplyr]{rename}}, \code{\link[dplyr]{slice}}, \code{\link[dplyr:group_by]{ungroup}}} + \item{ggplot2}{\code{\link[ggplot2]{autoplot}}} + \item{tidyr}{\code{\link[tidyr]{unnest}}} \item{tsibble}{\code{\link[tsibble:as-tsibble]{as_tsibble}}}