-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
65 lines (51 loc) · 1.92 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# ggtime
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![CRAN status](https://www.r-pkg.org/badges/version/ggtime)](https://CRAN.R-project.org/package=ggtime)
<!-- badges: end -->
The ggtime package provides tools for graphically analysing time series, with exploration of trend and seasonality. It utilises the tsibble data format for time series and produces plots with ggplot2.
## Installation
You can install the development version of ggtime from [GitHub](https://github.com/) with:
```r
# install.packages("remotes")
remotes::install_github("tidyverts/ggtime")
```
## Example
```{r example}
library(ggtime)
library(tsibble)
library(ggplot2)
tsibbledata::aus_production %>%
autoplot(Bricks)
cal_trans_x <- function() {
scales::trans_new(
name = "calendar",
transform = ggtime:::calendar_wrap,
inverse = identity,
breaks = scales::breaks_pretty(),
domain = c(0, 60*60*24*7)
)
}
pedestrian[with(pedestrian, Sensor == "Southern Cross Station" & Date < "2015-03-01"),] |>
autoplot(Count) +
# coord_calendar(xlim = c(Sys.time(), Sys.Date() + lubridate::days(1)))
ggplot2::coord_trans(x = cal_trans_x(), xlim = as.POSIXct(c("2024-03-25 00:00:00", "2024-03-31 23:59:59"))) +
scale_x_datetime(date_breaks = "day", date_labels = "%a")
pedestrian[with(pedestrian, Sensor == "Southern Cross Station" & Date < "2015-03-01"),] |>
ggplot(aes(x = Date_Time, y = Count)) +
geom_path() +
ggplot2::scale_x_continuous(transform = cal_trans_x(), limits = as.POSIXct(c("2024-03-25 00:00:00", "2024-03-31 23:59:59"))) +
coord_polar()
```