Before we start…

\(\rightarrow\) LAST SESSIONS ? BONUS material!

Once Shiny is covered, I like to extend to the realm of R capabilities:

  • geocomputation: handling maps - you can integrate them in Shiny!
  • third party data: retrieving sets fro APIs (e.g.: twitter) + a bit of text mining (always useful)
  • machine learning: very powerful when used correctly

BUT: other options are possible:
- mentoring: help on your projects (needed?, needed!)
- a use case: a short tour on how I build small apps
- open to suggestions: go on & propose!

Key reminder: basic data science functions (tidyverse)

  • data wrangling: select() keeps only some columns, filter() keeps rows depending on some conditions, mutate() creates new columns (see Session 1).
  • pivot tables: perform an analysis on subgroups to simplify the data. group_by() defines the groups and summarize() the indicator (usually: mean(something) or n()).
diamonds %>% 
  group_by(cut) %>%
  summarise(avg_size = mean(carat)) 

Look at column names:

diamonds %>%
  group_by(cut, clarity) %>%
  summarise(nb_diamonds = n(), 
            avg_price = mean(price) %>% round(2)) 

Going further with shiny

Themes & styles

Going further with html & CSS

First, super simple intros to HTML & CSS:
In notebooks & Shiny:

The source:
The fresh package:
One example of indirect (non visibly CSS) formatting:

font_avenir <- list(     # This is a formatting variable for plots' fonts
    family = "Avenir",   # This font has a modern look
    size = 9,
    color = 'grey')

p <-  movies %>% ggplot(aes(x = duration, y = imdb_score)) + geom_point() 
ggplotly(p) %>%
    layout(title = "Movies", font = font_avenir) # The font avenir is defined above

Going further with ggplot

General overview:

Going pro

Good looking tables: references

See also:

Going even further with Shiny (this never stops)