library(readxl)
Inequality <-read_excel("Coefficient_of_human_inequality.xlsx", col_types = c("numeric", "text", "text", "text", "text", "text", "numeric", "numeric", "numeric"), na = "NA")
## New names:
## * `` -> ...1
COL <- subset(Inequality, Inequality$country_name == "Colombia")
BRA <- subset(Inequality, Inequality$country_name == "Brazil")
PRU <- subset(Inequality, Inequality$country_name == "Peru")
DATA <- rbind(COL,BRA)
DATA <- rbind(DATA,PRU)
# Library
library(streamgraph)
## Loading required package: htmlwidgets
## Loading required package: htmltools
# Create data:
# Basic stream graph: just give the 3 arguments
DATA %>%
streamgraph(key="country_name", value="value", date="year", width = 800,scale = "continuous", interactive = FALSE) %>%
sg_fill_brewer("BuPu")
library(tidyverse)
## ── Attaching packages ──────────────────────────────────────────────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.0 ✓ purrr 0.3.4
## ✓ tibble 3.0.1 ✓ dplyr 0.8.5
## ✓ tidyr 1.1.0 ✓ stringr 1.4.0
## ✓ readr 1.3.1 ✓ forcats 0.5.0
## ── Conflicts ─────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(babynames)
library(streamgraph)
# Load dataset from github
data <- babynames %>%
filter(name %in% c("Ashley", "Amanda", "Jessica", "Patricia", "Linda", "Deborah", "Dorothy", "Betty", "Helen")) %>%
filter(sex=="F")
# Plot
data %>%
streamgraph(key="name", value="n", date="year") %>%
sg_fill_brewer("BuPu")