Regions GVApc

Per Region

---
title: "Animated Boxplot with Highcharter"
author: "Rubén F. Bustillo"
output: 
  flexdashboard::flex_dashboard:
    storyboard: true
    orientation: columns
    source_code: embed
    vertical_layout: fill
    theme: paper
---

```{r setup, include=FALSE}

# PACKAGES / LIBRARIES:

library(flexdashboard)
library(tidyverse)
library(plotly)
library(highcharter)
library(readxl)

options(scipen=999)

```


Regions GVApc
=============================================================================================


### Per Region

```{r, out.width="100%"}

peru_tabla <- read_excel("C:/Users/Usuario/Desktop/r_que_r/r_que_r/content/datasets/peru_tabla.xlsx")

peru_tabla <- peru_tabla %>%
  dplyr::select(Region, Year, VABpc_07, Geo)

peru_tabla$VABpc_07 <-  as.numeric(format(peru_tabla$VABpc_07, digits = 0))

hcboxplot(
  outliers = TRUE,
  x=peru_tabla$VABpc_07, 
  var= peru_tabla$Region,
  name = "Info",
  color = "grey"
  ) %>%
  hc_chart(type = "column") %>%
  hc_title(text = "Gross Value Added per capita by region (1995-2016)") %>%
  hc_subtitle(text = "GVA in constant 2007 PEN thousands" ) %>%
  hc_yAxis(title = list(text = "GVA per capita")) %>%
  hc_add_series(
    data = peru_tabla,
    type = "scatter",
    hcaes(x = "Region", y = "peru_tabla$VABpc_07", group = "Region")) %>%
  hc_plotOptions(scatter = list(
    color = "orange",
    marker = list(
      radius = 2,
      symbol = "circle",
      lineWith = 1)
  )) %>%
  hc_plotOptions(scatter = list(jitter = list(x = .1, y = 0))) %>%
  hc_add_theme(hc_theme_ffx())

```