Created
May 21, 2019 00:01
-
-
Save jkaupp/c5b8ca130a807f1c8a3c1f7c23b97f47 to your computer and use it in GitHub Desktop.
Old Flexdashboard live-code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Character Statistics From A Galaxy Far, Far Away" | |
output: | |
flexdashboard::flex_dashboard: | |
orientation: columns | |
vertical_layout: fill | |
--- | |
```{r setup, include=FALSE} | |
library(flexdashboard) | |
library(tidyverse) | |
``` | |
Column {data-width=650} | |
----------------------------------------------------------------------- | |
### I Find Your Lack of Height Disturbing | |
```{r} | |
starwars %>% | |
filter(!is.na(height), species == "Human") %>% | |
mutate(color = if_else(name == "Luke Skywalker", "firebrick", "grey30")) %>% | |
ggplot(aes(x = reorder(name, height), y = height, color = color)) + | |
geom_point() + | |
coord_flip() + | |
labs(x = NULL) + | |
scale_color_identity() + | |
theme_minimal() | |
``` | |
Column {data-width=350} | |
----------------------------------------------------------------------- | |
### I'm Heavy! Ben, Tell Him I'm Heavy! | |
```{r} | |
starwars %>% | |
filter(!is.na(mass), species == "Human") %>% | |
mutate(color = if_else(name == "Luke Skywalker", "firebrick", "grey30")) %>% | |
ggplot(aes(x = reorder(name, mass), y = mass, color = color)) + | |
geom_point() + | |
coord_flip() + | |
labs(x = NULL) + | |
scale_color_identity() + | |
theme_minimal() | |
``` | |
### Youth, Excitment, A Jedi Craves Not These Things | |
```{r} | |
starwars %>% | |
filter(!is.na(birth_year), species == "Human") %>% | |
mutate(color = if_else(name == "Luke Skywalker", "firebrick", "grey30")) %>% | |
ggplot(aes(x = reorder(name, birth_year), y = birth_year, color = color)) + | |
geom_point() + | |
coord_flip() + | |
labs(x = NULL) + | |
scale_color_identity() + | |
theme_minimal() | |
``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment