Skip to content

Commit 8642839

Browse files
committed
Use tsbox for converting ts object to tibble
1 parent f891dbc commit 8642839

File tree

5 files changed

+171
-186
lines changed

5 files changed

+171
-186
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Suggests:
5656
svglite (>= 1.2.0.9001),
5757
testthat (>= 2.1.0),
5858
vdiffr (>= 0.3.0),
59-
zoo
59+
tsbox
6060
Enhances: sp
6161
License: GPL-2 | file LICENSE
6262
URL: http://ggplot2.tidyverse.org, https://github.com/tidyverse/ggplot2

R/position-nudgestack.R

+5-10
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,15 @@
1313
#' This is useful if you're rotating both the plot and legend.
1414
#' @export
1515
#' @examples
16-
#' ESM <- data.frame(
17-
#' as.matrix(EuStockMarkets),
18-
#' date = as.Date(paste(1, zoo::as.yearmon(time(EuStockMarkets))),
19-
#' format = "%d %b %Y"
20-
#' )
21-
#' )
16+
#' ESM <- tsbox::ts_tbl(EuStockMarkets)
2217
#'
2318
#' ESM_prep <- ESM %>%
24-
#' tidyr::gather(key = key, value = value, -date) %>%
25-
#' group_by(date, key) %>%
19+
#' dplyr::mutate(time = as.Date(paste0(format(time, "%Y-%m"),"-1"))) %>%
20+
#' group_by(id, time) %>%
2621
#' summarize(value = mean(value)) %>%
27-
#' filter(date >= "1995-01-01" & date < "1998-01-01")
22+
#' filter(time >= "1995-01-01" & time < "1998-01-01")
2823
#'
29-
#' ggplot(data = ESM_prep, mapping = aes(x = date, y = value, fill = key)) +
24+
#' ggplot(data = ESM_prep, mapping = aes(x = time, y = value, fill = id)) +
3025
#' geom_col(position = position_nudgestack(x = 15))
3126
position_nudgestack <- function(x = 0, y = 0, vjust = 1, reverse = FALSE) {
3227
ggproto(NULL, PositionNudgeStack,

man/position_nudgestack.Rd

+5-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)