---
title: "Basics"
author: "Wojtek Kostelecki"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Basics}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

# Overview

Use ezplot to quickly create presentation-ready charts that are also useful for
exploratory data analysis. By default, ezplot functions aggregate multiple 
values of y for repeated categories of x, group, facet_y and facet_x.


# Load data

```{r, fig.show='hold'}
library(ezplot)
suppressPackageStartupMessages(library(tsibble))
library(tsibbledata)
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(lubridate))
```


## line_plot
```{r, echo=TRUE, results='asis', fig.width = 7.1}
line_plot(ansett, x = "Week", y = "Passengers")
line_plot(ansett, x = "Week", y = "Passengers", group = "Class")
```

## bar_plot
```{r, echo=TRUE, results='asis', fig.width = 7.1}
df = ansett %>% 
  filter(between(year(Week), 1988, 1991))
bar_plot(df, x = "year(Week)", y = "Passengers")
bar_plot(df, x = "year(Week)", y = "Passengers", group = "Class")
```

