Paquetes cargados
library(ggplot2)
library(dplyr)
library(highcharter)
Primer Grafico - Estatico
data(mpg, package="ggplot2")
# mpg <- read.csv("http://goo.gl/uEeRGu")
# Scatterplot
theme_set(theme_bw()) # pre-set the bw theme.
g <- ggplot(mpg, aes(cty, hwy))
g + geom_count(col="tomato3", show.legend=F) +
labs(subtitle="mpg: city vs highway mileage",
y="hwy",
x="cty",
title="Counts Plot")

Segundo grafico - dinamico
mpgman2 <- mpg %>%
count(class, year) %>%
glimpse()
## Observations: 14
## Variables: 3
## $ class <chr> "2seater", "2seater", "compact", "compact", "midsize", "...
## $ year <int> 1999, 2008, 1999, 2008, 1999, 2008, 1999, 2008, 1999, 20...
## $ n <int> 2, 3, 25, 22, 20, 21, 6, 5, 16, 17, 19, 16, 29, 33
hchart(mpgman2, "column", hcaes(x = class, y = n, group = year)) %>% hc_add_theme(hc_theme_darkunica())