/
visualization.Rmd
94 lines (67 loc) · 1.51 KB
/
visualization.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
title: "Visualization"
author: "Aravind Hebbali"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Visualization}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
```{r, echo=FALSE, message=FALSE}
library(descriptr)
library(dplyr)
```
## Introduction
In this document, we will introduce you to functions for generating different
types of plots.
## Data
We have modified the `mtcars` data to create a new data set `mtcarz`. The only
difference between the two data sets is related to the variable types.
```{r egdata}
str(mtcarz)
```
## Continuous Data
The following functions will create plots for all or subset of continuous
variables in the data set.
#### Histograms
```{r hist}
ds_plot_histogram(mtcarz)
```
#### Density Plots
```{r density}
ds_plot_density(mtcarz)
```
#### Box Plots
```{r box_single}
ds_plot_box_single(mtcarz)
```
#### Scatter Plots
```{r scatter}
ds_plot_scatter(mtcarz, mpg, disp, hp)
```
## Categorical Data
The following functions will create plots for all or subset of categorical
variables in the data set.
#### Bar Plot
```{r bar}
ds_plot_bar(mtcarz)
```
#### Stacked Bar Plot
```{r bar_stacked}
ds_plot_bar_stacked(mtcarz, cyl, gear, am)
```
#### Grouped Bar Plot
```{r bar_grouped}
ds_plot_bar_grouped(mtcarz, cyl, gear, am)
```
#### Grouped Box Plots
```{r box_group}
ds_plot_box_group(mtcarz, cyl, gear, mpg, disp)
```