<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/automated-dashboard-with-various-correlation-visualizations-in-r/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://datascienceplus.com/automated-dashboard-with-various-correlation-visualizations-in-r/"> R Programming – DataScience+</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<ul></ul>
<p><strong>
<p>Categories</p>
<p></p></strong>
<ol>
<li><a rel="nofollow" href="https://datascienceplus.com/category/programming/" title="Permanent Link toProgramming" target="_blank">Programming</a></li>
</ol>
<p><strong>
<p>Tags</p>
<p></p></strong>
<ol>
<li><a rel="nofollow" href="https://datascienceplus.com/tag/correlation/" title="Permanent Link toCorrelation" target="_blank">Correlation</a></li>
<li><a rel="nofollow" href="https://datascienceplus.com/tag/data-visualisation/" title="Permanent Link toData Visualisation" target="_blank">Data Visualisation</a></li>
<li><a rel="nofollow" href="https://datascienceplus.com/tag/rstats/" title="Permanent Link toR Programming" target="_blank">R Programming</a></li>
</ol>
<p>In this article, you learn how to make Automated Dashboard with various correlation visualizations in R. First you need to install the `rmarkdown` package into your R library. Assuming that you installed the `rmarkdown`, next you create a new `rmarkdown` script in R. </p>
<p>After this you type the following code in order to create a dashboard with <code>rmarkdown</code> and <code>flexdashboard</code>:</p>
<pre>
---
title: &quot;Dashboard visualizations in R: Scatter plots&quot;
author: &quot;Kristian Larsen&quot;
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: scroll
---

```{r setup, include=FALSE}
library(flexdashboard)
# install.packages(&quot;ggplot2&quot;)
# load package and data
options(scipen=999)  # turn-off scientific notation like 1e+48
library(ggplot2)
theme_set(theme_bw())  # pre-set the bw theme.
data(&quot;midwest&quot;, package = &quot;ggplot2&quot;)
midwest &lt;- read.csv(&quot;http://goo.gl/G1K41K&quot;)  # bkup data source
options(scipen = 999)
library(ggplot2)
library(ggalt)
library(plotly)
midwest_select  350000 &amp; 
                            midwest$poptotal  0.01 &amp; 
                            midwest$area &lt; 0.1, ]
# load package and data
library(ggplot2)
data(mpg, package=&quot;ggplot2&quot;) # alternate source: &quot;http://goo.gl/uEeRGu&quot;)
theme_set(theme_bw())  # pre-set the bw theme.

g &lt;- ggplot(mpg, aes(cty, hwy))
# load package and data
library(ggplot2)
data(mpg, package=&quot;ggplot2&quot;)
mpg &lt;- read.csv(&quot;http://goo.gl/uEeRGu&quot;)

# load package and data
library(ggplot2)
data(mpg, package=&quot;ggplot2&quot;)
# mpg &lt;- read.csv(&quot;http://goo.gl/uEeRGu&quot;)
```

Row
-----------------------------------------------------------------------

### Chart A: Scatterplot

```{r}
gg &lt;- ggplot(midwest, aes(x=area, y=poptotal)) + 
  geom_point(aes(col=state, size=popdensity)) + 
  geom_smooth(method=&quot;loess&quot;, se=F) + 
  xlim(c(0, 0.1)) + 
  ylim(c(0, 500000)) + 
  labs(subtitle=&quot;Area Vs Population&quot;, 
       y=&quot;Population&quot;, 
       x=&quot;Area&quot;, 
       title=&quot;Scatterplot&quot;, 
       caption = &quot;Source: midwest&quot;)

plot(gg)
ggplotly(p = ggplot2::last_plot())
```


### Chart B: Scatterplot + Encircle

```{r}
ggplot(midwest, aes(x=area, y=poptotal)) + 
  geom_point(aes(col=state, size=popdensity)) +   # draw points
  geom_smooth(method=&quot;loess&quot;, se=F) + 
  xlim(c(0, 0.1)) + 
  ylim(c(0, 500000)) +   # draw smoothing line
  geom_encircle(aes(x=area, y=poptotal), 
                data=midwest_select, 
                color=&quot;red&quot;, 
                size=2, 
                expand=0.08) +   # encircle
  labs(subtitle=&quot;Area Vs Population&quot;, 
       y=&quot;Population&quot;, 
       x=&quot;Area&quot;, 
       title=&quot;Scatterplot + Encircle&quot;, 
       caption=&quot;Source: midwest&quot;)
```

Row
-----------------------------------------------------------------------

### Cart C: Jitter Plot


```{r}
g + geom_point() + 
  geom_smooth(method=&quot;lm&quot;, se=F) +
  labs(subtitle=&quot;mpg: city vs highway mileage&quot;, 
       y=&quot;hwy&quot;, 
       x=&quot;cty&quot;, 
       title=&quot;Scatterplot with overlapping points&quot;, 
       caption=&quot;Source: midwest&quot;)
ggplotly(p = ggplot2::last_plot())
```

### Cart D: Jitter Points


```{r}
# Scatterplot
theme_set(theme_bw())  # pre-set the bw theme.
g &lt;- ggplot(mpg, aes(cty, hwy))
g + geom_jitter(width = .5, size=1) +
  labs(subtitle=&quot;mpg: city vs highway mileage&quot;, 
       y=&quot;hwy&quot;, 
       x=&quot;cty&quot;, 
       title=&quot;Jittered Points&quot;)
ggplotly(p = ggplot2::last_plot())
```

Row
-----------------------------------------------------------------------

### Chart E: Counts Chart

```{r}
# Scatterplot
theme_set(theme_bw())  # pre-set the bw theme.
g &lt;- ggplot(mpg, aes(cty, hwy))
g + geom_count(col=&quot;tomato3&quot;, show.legend=F) +
  labs(subtitle=&quot;mpg: city vs highway mileage&quot;, 
       y=&quot;hwy&quot;, 
       x=&quot;cty&quot;, 
       title=&quot;Counts Plot&quot;)
ggplotly(p = ggplot2::last_plot())
```

### Chart F: Bubble plot

```{r}
# load package and data
library(ggplot2)
library(gganimate)
data(mpg, package=&quot;ggplot2&quot;)
# mpg &lt;- read.csv(&quot;http://goo.gl/uEeRGu&quot;)

mpg_select &lt;- mpg[mpg$manufacturer %in% c(&quot;audi&quot;, &quot;ford&quot;, &quot;honda&quot;, &quot;hyundai&quot;), ]

# Scatterplot
theme_set(theme_bw())  # pre-set the bw theme.
g &lt;- ggplot(mpg_select, aes(displ, cty)) + 
  labs(subtitle=&quot;mpg: Displacement vs City Mileage&quot;,
       title=&quot;Bubble chart&quot;)

g + geom_jitter(aes(col=manufacturer, size=hwy)) + 
  geom_smooth(aes(col=manufacturer), method=&quot;lm&quot;, se=F)
ggplotly(p = ggplot2::last_plot())
```

Row
-----------------------------------------------------------------------
### Chart G: Marginal Histogram / Boxplot

```{r}
# load package and data
library(ggplot2)
library(ggExtra)
data(mpg, package=&quot;ggplot2&quot;)
# mpg &lt;- read.csv(&quot;http://goo.gl/uEeRGu&quot;)

# Scatterplot
theme_set(theme_bw())  # pre-set the bw theme.
mpg_select = 35 &amp; mpg$cty > 27, ]
g &lt;- ggplot(mpg, aes(cty, hwy)) + 
  geom_count() + 
  geom_smooth(method=&quot;lm&quot;, se=F)

ggMarginal(g, type = &quot;histogram&quot;, fill=&quot;transparent&quot;)
ggMarginal(g, type = &quot;boxplot&quot;, fill=&quot;transparent&quot;)
# ggMarginal(g, type = &quot;density&quot;, fill=&quot;transparent&quot;)
```

### Chart H: Correlogram
```{r}
# devtools::install_github(&quot;kassambara/ggcorrplot&quot;)
library(ggplot2)
library(ggcorrplot)

# Correlation matrix
data(mtcars)
corr &lt;- round(cor(mtcars), 1)

# Plot
ggcorrplot(corr, hc.order = TRUE, 
           type = &quot;lower&quot;, 
           lab = TRUE, 
           lab_size = 3, 
           method=&quot;circle&quot;, 
           colors = c(&quot;tomato2&quot;, &quot;white&quot;, &quot;springgreen3&quot;), 
           title=&quot;Correlogram of mtcars&quot;, 
           ggtheme=theme_bw)
```
</pre>
<p>Screenshot:<br>
<a rel="nofollow" href="https://i0.wp.com/datascienceplus.com/wp-content/uploads/2018/12/V1-1.jpg?ssl=1" target="_blank"><img sizes="(max-width: 490px) 100vw, 490px" src="https://i2.wp.com/datascienceplus.com/wp-content/uploads/2018/12/V1-1-490x167.jpg?w=450&ssl=1" alt="" class="wp-image-18862" data-recalc-dims="1"></a></p>
<p>The result of the above coding are published with RPubs <a rel="nofollow" href="http://rpubs.com/knl84/445022" target="_blank">here</a>.</p>
<h3>References</h3>
<ol>
<li><a rel="nofollow" href="https://rmarkdown.rstudio.com/flexdashboard/" target="_blank">Using flexdashboard in R</a></li>
</ol>
<p><strong>
<p>Related Post</p>
<p></p></strong>
<ol>
<li><a rel="nofollow" href="https://datascienceplus.com/automated-dashboard-with-visualization-and-regression-for-healthcare-data/" title="Permanent Link toAutomated Dashboard with Visualization and Regression for Healthcare Data" target="_blank">Automated Dashboard with Visualization and Regression for Healthcare Data</a></li>
<li><a rel="nofollow" href="https://datascienceplus.com/create-easy-automated-dashbords-with-r-and-markdown/" title="Permanent Link toCreate easy automated dashbords with R and Markdown" target="_blank">Create easy automated dashbords with R and Markdown</a></li>
<li><a rel="nofollow" href="https://datascienceplus.com/send-desktop-notifications-from-r-in-windows-linux-and-mac/" title="Permanent Link toSend Desktop Notifications from R in Windows, Linux and Mac" target="_blank">Send Desktop Notifications from R in Windows, Linux and Mac</a></li>
<li><a rel="nofollow" href="https://datascienceplus.com/chaid-vs-ranger-vs-xgboost-a-comparison/" title="Permanent Link toCHAID vs. ranger vs. xgboost — a comparison" target="_blank">CHAID vs. ranger vs. xgboost — a comparison</a></li>
<li><a rel="nofollow" href="https://datascienceplus.com/common-mistakes-to-avoid-when-learning-to-code-in-python/" title="Permanent Link toCommon Mistakes to Avoid When Learning to Code in Python" target="_blank">Common Mistakes to Avoid When Learning to Code in Python</a></li>
</ol>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://datascienceplus.com/automated-dashboard-with-various-correlation-visualizations-in-r/"> R Programming – DataScience+</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/QfaKeVkYqU0" height="1"></a></div>