Shiny is good for you - Data Visualisation

How does it work ? shiny and you. Live demo. Conclusion. Références. INTERACTIONS ? ▷ Querying : ▻ Adding informing on the fly (e.g. What is the value of ...
2MB taille 3 téléchargements 570 vues
What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Shiny is good for you !

Christophe Bontemps Toulouse School of Economics, INRA @Xtophe_Bontemps

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

A BOUT ME & MY J OB I

Econometrician @ Toulouse School of Economics

Conclusion

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

A BOUT ME & MY J OB I

Econometrician @ Toulouse School of Economics

I

R useR ! (among others)

Conclusion

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

A BOUT ME & MY J OB I

Econometrician @ Toulouse School of Economics

I

R useR ! (among others)

I

Teach Data Visualisation (among others)

Conclusion

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

A BOUT ME & MY J OB I

Econometrician @ Toulouse School of Economics

I

R useR ! (among others)

I

Teach Data Visualisation (among others)

Conclusion

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

A BOUT ME & MY J OB I

Econometrician @ Toulouse School of Economics

I

R useR ! (among others)

I

Teach Data Visualisation (among others)

I

Co-organiser of the Toulouse Dataviz Meetup

Conclusion

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

W HAT IS S H I N Y ?

An I

package to build interactive web applications with R : Requires

( also easier with RStudio)

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

W HAT IS S H I N Y ?

An

package to build interactive web applications with R : ( also easier with RStudio)

I

Requires

I

Easy to write applications

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

W HAT IS S H I N Y ?

An

package to build interactive web applications with R : ( also easier with RStudio)

I

Requires

I

Easy to write applications

I

No HTML/CSS/JavaScript knowledge required ...

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

W HAT IS S H I N Y ?

An

package to build interactive web applications with R : ( also easier with RStudio)

I

Requires

I

Easy to write applications

I

No HTML/CSS/JavaScript knowledge required ...

I

But ...fully customizable with HTML/CSS/JavaScript though !

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

W HAT IS S H I N Y ?

An

package to build interactive web applications with R : ( also easier with RStudio)

I

Requires

I

Easy to write applications

I

No HTML/CSS/JavaScript knowledge required ...

I

But ...fully customizable with HTML/CSS/JavaScript though !

I

Some examples in a minute

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

W HAT IS S H I N Y ?

An

package to build interactive web applications with R : ( also easier with RStudio)

I

Requires

I

Easy to write applications

I

No HTML/CSS/JavaScript knowledge required ...

I

But ...fully customizable with HTML/CSS/JavaScript though !

I

Some examples in a minute

I

shiny is easy

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

E XAMPLES

Housing prices by Eric Ray Anderson

The Genetic Map Comparator by Yan Holtz, Jacques David, Vincent Ranwez

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

O THER EXAMPLES

A MOOC monitor (C. Bontemps, DEE 2017)

Show me shiny (Fully reusable applications)

Conclusion

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HY INTERACTIONS IN D ATAVIZ ?

For Unwin et al. (2006), interactions have only 3 components : I

Querying

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HY INTERACTIONS IN D ATAVIZ ?

For Unwin et al. (2006), interactions have only 3 components : I

Querying

I

Selection and linking

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HY INTERACTIONS IN D ATAVIZ ?

For Unwin et al. (2006), interactions have only 3 components : I

Querying

I

Selection and linking

I

Varying plot characteristics

Références

What is shiny ?

Examples

Why ?

I NTERACTIONS ? I

Querying :

How does it work ?

shiny and you

Live demo

Conclusion

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

I NTERACTIONS ? I

Querying : I

Adding informing on the fly (e.g. What is the value of that outlier ?)

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

I NTERACTIONS ? I

Querying : I

I

Adding informing on the fly (e.g. What is the value of that outlier ?) Adding dimensions to 2D-graphs

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

I NTERACTIONS ? I

Querying : I

I

I

Adding informing on the fly (e.g. What is the value of that outlier ?) Adding dimensions to 2D-graphs

Selection and linking :

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

I NTERACTIONS ? I

Querying : I

I

I

Adding informing on the fly (e.g. What is the value of that outlier ?) Adding dimensions to 2D-graphs

Selection and linking : I

Choosing variables of interest, displays of interest

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

I NTERACTIONS ? I

Querying : I

I

I

Adding informing on the fly (e.g. What is the value of that outlier ?) Adding dimensions to 2D-graphs

Selection and linking : I I

Choosing variables of interest, displays of interest Selecting sub-samples, groups of interest, outliers

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

I NTERACTIONS ? I

Querying : I

I

I

Selection and linking : I I

I

Adding informing on the fly (e.g. What is the value of that outlier ?) Adding dimensions to 2D-graphs Choosing variables of interest, displays of interest Selecting sub-samples, groups of interest, outliers

Varying plot characteristics :

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

I NTERACTIONS ? I

Querying : I

I

I

Selection and linking : I I

I

Adding informing on the fly (e.g. What is the value of that outlier ?) Adding dimensions to 2D-graphs Choosing variables of interest, displays of interest Selecting sub-samples, groups of interest, outliers

Varying plot characteristics : I

Rescaling (zoom & pan), resizing, zooming, reordering,..

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

I NTERACTIONS ? I

Querying : I

I

I

Selection and linking : I I

I

Adding informing on the fly (e.g. What is the value of that outlier ?) Adding dimensions to 2D-graphs Choosing variables of interest, displays of interest Selecting sub-samples, groups of interest, outliers

Varying plot characteristics : I I

Rescaling (zoom & pan), resizing, zooming, reordering,.. Scale, colour (colour blind option), legend

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

I NTERACTIONS ? I

Querying : I

I

I

Selection and linking : I I

I

Adding informing on the fly (e.g. What is the value of that outlier ?) Adding dimensions to 2D-graphs Choosing variables of interest, displays of interest Selecting sub-samples, groups of interest, outliers

Varying plot characteristics : I I I

Rescaling (zoom & pan), resizing, zooming, reordering,.. Scale, colour (colour blind option), legend Time varying animations

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

I NTERACTIONS ? I

Querying : I

I

I

Selection and linking : I I

I

Adding informing on the fly (e.g. What is the value of that outlier ?) Adding dimensions to 2D-graphs Choosing variables of interest, displays of interest Selecting sub-samples, groups of interest, outliers

Varying plot characteristics : I I I I

Rescaling (zoom & pan), resizing, zooming, reordering,.. Scale, colour (colour blind option), legend Time varying animations Adding interaction between graphs (panels, tabs)

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HY S H I N Y ? With shiny we use mostly the last 2 features : “selection and linking” & “changing the plot characteristics”. But : I

shiny is not only for dataviz, also for easy web sharing applications.

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HY S H I N Y ? With shiny we use mostly the last 2 features : “selection and linking” & “changing the plot characteristics”. But : I

shiny is not only for dataviz, also for easy web sharing applications.

I

shiny is easy

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HY S H I N Y ? With shiny we use mostly the last 2 features : “selection and linking” & “changing the plot characteristics”. But : I

shiny is not only for dataviz, also for easy web sharing applications.

I

shiny is easy shiny is not the only one !

I

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HY S H I N Y ? With shiny we use mostly the last 2 features : “selection and linking” & “changing the plot characteristics”. But : I

shiny is not only for dataviz, also for easy web sharing applications.

I

shiny is easy shiny is not the only one !

I

I

Tableau

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HY S H I N Y ? With shiny we use mostly the last 2 features : “selection and linking” & “changing the plot characteristics”. But : I

shiny is not only for dataviz, also for easy web sharing applications.

I

shiny is easy shiny is not the only one !

I

I I

Tableau D3.js

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HY S H I N Y ? With shiny we use mostly the last 2 features : “selection and linking” & “changing the plot characteristics”. But : I

shiny is not only for dataviz, also for easy web sharing applications.

I

shiny is easy shiny is not the only one !

I

I I

Tableau D3.js

Specificity of shiny

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HY S H I N Y ? With shiny we use mostly the last 2 features : “selection and linking” & “changing the plot characteristics”. But : I

shiny is not only for dataviz, also for easy web sharing applications.

I

shiny is easy shiny is not the only one !

I

I I

Tableau D3.js

Specificity of shiny I

Simple, open source, based on major statistical software

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HY S H I N Y ? With shiny we use mostly the last 2 features : “selection and linking” & “changing the plot characteristics”. But : I

shiny is not only for dataviz, also for easy web sharing applications.

I

shiny is easy shiny is not the only one !

I

I I

Tableau D3.js

Specificity of shiny I I

Simple, open source, based on major statistical software Everything you do in R can be integrated in shiny !

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HY S H I N Y ? With shiny we use mostly the last 2 features : “selection and linking” & “changing the plot characteristics”. But : I

shiny is not only for dataviz, also for easy web sharing applications.

I

shiny is easy shiny is not the only one !

I

I I

Tableau D3.js

Specificity of shiny I I I

Simple, open source, based on major statistical software Everything you do in R can be integrated in shiny ! Huge community, lots of developments

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HY S H I N Y ? With shiny we use mostly the last 2 features : “selection and linking” & “changing the plot characteristics”. But : I

shiny is not only for dataviz, also for easy web sharing applications.

I

shiny is easy shiny is not the only one !

I

I I

Tableau D3.js

Specificity of shiny I I I I

Simple, open source, based on major statistical software Everything you do in R can be integrated in shiny ! Huge community, lots of developments Lots of re-usable examples

Références

What is shiny ?

Examples

Why ?

How does it work ?

H OW WORKS S H I N Y ?

There are basically 2 files I

The user interface file (ui.R)

shiny and you

Live demo

Conclusion

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

H OW WORKS S H I N Y ?

There are basically 2 files I

The user interface file (ui.R)

I

The R code server (server.R)

Live demo

Conclusion

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

H OW WORKS S H I N Y ?

There are basically 2 files I

The user interface file (ui.R)

I

The R code server (server.R)

I

Eventually, a global file with initial treatments (global.R)

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

H OW WORKS S H I N Y ?

There are basically 2 files I

The user interface file (ui.R)

I

The R code server (server.R)

I

Eventually, a global file with initial treatments (global.R)

I

Other things I don’t want to talk now !

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

H OW WORKS S H I N Y ?

The server.R computes (in R) the elements that the ui.R request and displays I

In the ui.R, we find functions that are simply HTML wrappers

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

H OW WORKS S H I N Y ?

The server.R computes (in R) the elements that the ui.R request and displays I

In the ui.R, we find functions that are simply HTML wrappers

I

The server.R computes elements requested

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

H OW WORKS S H I N Y ?

The server.R computes (in R) the elements that the ui.R request and displays I

In the ui.R, we find functions that are simply HTML wrappers

I

The server.R computes elements requested The two files are very different

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

H OW WORKS S H I N Y ?

The server.R computes (in R) the elements that the ui.R request and displays I

In the ui.R, we find functions that are simply HTML wrappers

I

The server.R computes elements requested The two files are very different

I

Code in the ui.R file is shiny code (+ html)

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

H OW WORKS S H I N Y ?

The server.R computes (in R) the elements that the ui.R request and displays I

In the ui.R, we find functions that are simply HTML wrappers

I

The server.R computes elements requested The two files are very different

I

Code in the ui.R file is shiny code (+ html)

I

Code in the server.R is R code

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

S TRUCTURE OF A S H I N Y APP The basic structure is simple ui.R & server.R should be in the same directory

From Iowa State university

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

H OW WORKS S H I N Y ?

Let’s built our first shiny application with RStudio

Conclusion

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HAT IS U I .R DOING ? ui.R is collecting actions (inputs) and displaying elements (outputs)

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HAT IS U I .R DOING ? ui.R is collecting actions (inputs) and displaying elements (outputs)

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HAT IS U I .R DOING ? ui.R is collecting actions (inputs) and displaying elements (outputs)

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HAT IS U I .R DOING ? ui.R is collecting actions (inputs) and displaying elements (outputs)

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HAT IS S E R V E R .R DOING ?

server.R is receiving actions (inputs) and computing elements (outputs) to be displayed by ui.R

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HAT IS S E R V E R .R DOING ?

server.R is receiving actions (inputs) and computing elements (outputs) to be displayed by ui.R

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HAT IS S E R V E R .R DOING ?

server.R is receiving actions (inputs) and computing elements (outputs) to be displayed by ui.R

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HAT IS S E R V E R .R DOING ?

server.R is receiving actions (inputs) and computing elements (outputs) to be displayed by ui.R

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HAT IS S E R V E R .R DOING ?

server.R is receiving actions (inputs) and computing elements (outputs) to be displayed by ui.R

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

W HAT IS U I .R DOING ? ui.R is collecting actions (inputs) and displaying elements (outputs)

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

L IVE DEMO - PREPARED WITH E. M AIGNÉ (INRA) Let us modify ui.R and server.R

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

A NOTE ON SCOPE What is done once vs what is done every time the function is called ?

See scoping in shiny

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

W HATEVER YOU DO IN R, CAN BE DONE IN S H I N Y !

server.R basically receives parameters (inputs) and computes ! So whatever you do in R can be an output for shiny : I

Text ( summaries, estimation results, raw numbers, ..)

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

W HATEVER YOU DO IN R, CAN BE DONE IN S H I N Y !

server.R basically receives parameters (inputs) and computes ! So whatever you do in R can be an output for shiny : I

Text ( summaries, estimation results, raw numbers, ..)

I

Plot (Statistical, images, interactive plots ? ...)

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

W HATEVER YOU DO IN R, CAN BE DONE IN S H I N Y !

server.R basically receives parameters (inputs) and computes ! So whatever you do in R can be an output for shiny : I

Text ( summaries, estimation results, raw numbers, ..)

I

Plot (Statistical, images, interactive plots ? ...)

I

Table (Standard, table widget, customized, ...)

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

M ANY OPTIONS FOR THE INTERFACE : H IGHLY CUSTOMABLE ! ui.R has a huge (and increasing) collection of Inputs :

Références

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

S TRUCTURE OF A MORE COMPLEX S H I N Y APP For more complex structures global.R can complement ui.R & server.R (in the same directory)

From Iowa State university

What is shiny ?

Examples

SHINY An I

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

? package to build interactive web applications with R :

Requires

( also easier with RStudio)

What is shiny ?

Examples

SHINY An

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

? package to build interactive web applications with R :

I

Requires

( also easier with RStudio)

I

It is very easy to write applications

What is shiny ?

Examples

SHINY An

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

? package to build interactive web applications with R :

I

Requires

( also easier with RStudio)

I

It is very easy to write applications

I

No HTML/CSS/JavaScript knowledge required ...

What is shiny ?

Examples

SHINY An

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

? package to build interactive web applications with R :

I

Requires

( also easier with RStudio)

I

It is very easy to write applications

I

No HTML/CSS/JavaScript knowledge required ...

I

Publication tool embedded

What is shiny ?

Examples

SHINY An

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

Références

? package to build interactive web applications with R :

I

Requires

( also easier with RStudio)

I

It is very easy to write applications

I

No HTML/CSS/JavaScript knowledge required ...

I

Publication tool embedded

see ShinyApps.io

What is shiny ?

Examples

Why ?

How does it work ?

shiny and you

Live demo

Conclusion

R EFERENCES I

Unwin, A., Theus, M., and Hofmann, H. (2006). Graphics of large datasets : visualizing a million. Springer Science & Business Media.

Références