Quinoa raw denim fam, lyft chartreuse hammock typewriter. Beard craft beer disrupt, poutine green juice viral forage ennui readymade everyday carry. Shoreditch normcore paleo swag offal lomo vegan etsy pitchfork. Next level austin gastropub poutine roof party fam air plant ennui quinoa celiac literally. Chia lo-fi ennui fanny pack, kogi retro letterpress banjo small batch. Live-edge street art pabst vice venmo.

Column

Price by Carat

Column

Clarity in the diamonds Dataset

Average Price by Cut and Clarity

---
title: "Diamonds Dashboard"
output: 
  flexdashboard::flex_dashboard:
    source_code: embed
    orientation: columns
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
library(ggplot2)
library(dplyr)
data(diamonds)
```

```{r, result='asis', echo=FALSE}
## using Hipster Ipsum place-holder text.
con <- curl::curl("https://hipsum.co/api/?type=hipster-centric&sentences=6")
hip <- rjson::fromJSON(readLines(con))
htmltools::p(hip)
```



Column {data-width=650}
-----------------------------------------------------------------------

### Price by Carat 

```{r}
diamonds %>% 
  ggplot(aes(x=carat, y=price, colour=color)) + 
    geom_point(alpha=.15) + 
    facet_wrap(~cut) + 
    theme_minimal() +
    labs(x="Carat", y="Price", colour="Color") +
    guides(colour = guide_legend(override.aes = list(alpha=1))) 
```

Column {data-width=350}
-----------------------------------------------------------------------

### Clarity in the `diamonds` Dataset

```{r}
diamonds %>% 
  ggplot(aes(x=clarity)) + 
    geom_bar(stat="count") + 
    theme_minimal() + 
    labs(x="Diamond Clarity", y = "Frequency")

```

### Average Price by Cut and Clarity

```{r}
diamonds %>% 
  filter(carat > .75 & carat <=1) %>% 
  group_by(clarity, cut) %>% 
  summarise(price = mean(price), n=n()) %>% 
  ggplot(aes(x=clarity, y=cut, fill=price)) + 
    geom_tile() + 
    geom_text(aes(label=n), col="white") + 
    theme_minimal() + 
    labs(x = "", y = "", fill="Average\nPrice")
```