SlideShare une entreprise Scribd logo
1  sur  25
Presents
Quick Crash Course on R Package- Shiny
R Package – Shiny
Crash Course
PRESENTS
What is R shiny?
A web application framework for R that allows
you to turn your
data into an interactive web App.
You can easily integrate R with webpage.
Suppose you want your web page run machine
learning algorithms like random forest, SVM
etc and display summary of the model with
the flexibility of selecting inputs from user.
Shiny can do it very easily.
How does it work?
Shiny apps have two components:
- user interface script (controls layout and appearance by
converting R code into HTML)
- server script (contains the code needed to build the app)
How does it work?
How does it work?
• ui - nested R functions that assemble an
HTML user interface for your app
• server - a function with instructions on how
to build and rebuild the R objects displayed
in the UI
• shinyApp - combines ui and server into
an app. Wrap with runApp() if calling from a
sourced script or inside a function
Do I need to know how to code in HTML?
No knowledge of HTML, JavaScript or CSS is required. However, you
can make your apps more interesting if you know some HTML codes.
There are some excellent tutorials and lots of links for more
information at http://shiny.rstudio.com/
CSS + java-script + R
Getting Started:
> install.packages("shiny")
> library(shiny)
> runApp("my_app")
As a minimum, every shiny app has two R scripts (named ui and server) saved within the same
directory (e.g. “my_app”).
Getting Started:
The fluidPage function allows the display to adjust
automatically to the browser dimensions.
The unnamed function contains the
code needed to run the app.
Getting Started:
The fluidPage function allows the display to adjust
automatically to the browser dimensions.
The unnamed function contains the
code needed to run the app.
Other scripts (written in standard R code), libraries and data can be called by the
server script if they are needed, using standard R commands above the shiny Server function.
The User Interface (ui.R)
A series of nested shiny functions control
the layout of the content. sidebarLayout is
a function with two compulsory arguments,
both themselves functions (sidebarPanel
and mainPanel). An optional argument
controls the position of the panels. Text is
written as a character string inside
quotation marks.
# ui.R
shinyUI(fluidPage(
titlePanel("title panel"),
sidebarLayout(position = "right",
sidebarPanel( "sidebar panel"),
mainPanel("main panel")
)
))
The User Interface (ui.R)
# ui.R
shinyUI(fluidPage(
titlePanel("title panel"),
sidebarLayout(position = "right",
sidebarPanel( "sidebar panel"),
mainPanel("main panel")
)
))
Building an App :
Complete the template by adding arguments to fluidPage() and a
body to the server function :
Building an App :
Save your template as app.R. Alternatively, split your template into two files named ui.R and server.R.
Adding Widgets
Widgets are interactive web elements. A series of inbuild shiny functions allows widgets to be
easily added to webpages. Each function has several arguments. It must have at least a name
(used to access its value, but not visible) and a label (visible on the page). Both are character
strings. Other arguments are widget specific.
Adding Widgets
Examples – US Giant Stocks
More Examples
More Examples:
Why Shiny?
Shiny is easy and powerful
• You can make your analyses Shared, Live and explorable
• It’s going to get more powerful - interactive
graphics like d3 are coming
• You can get support from the community and RStudio
• Start coding - and show us what you can achieve
Step 1 - Create New Web Shiny App
Step 2 - Run App :
So, Lets go practical ……..
Thanks for watching!

Contenu connexe

Tendances

WSO2 ESB Integration with REST
WSO2 ESB Integration with RESTWSO2 ESB Integration with REST
WSO2 ESB Integration with REST
WSO2
 

Tendances (20)

CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)
 
React Fiber
React FiberReact Fiber
React Fiber
 
Introduction to Web Development
Introduction to Web DevelopmentIntroduction to Web Development
Introduction to Web Development
 
jQuery
jQueryjQuery
jQuery
 
Web server
Web serverWeb server
Web server
 
Web Development In 2018
Web Development In 2018Web Development In 2018
Web Development In 2018
 
What is an API?
What is an API?What is an API?
What is an API?
 
Java web services using JAX-WS
Java web services using JAX-WSJava web services using JAX-WS
Java web services using JAX-WS
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
Bootstrap 4 ppt
Bootstrap 4 pptBootstrap 4 ppt
Bootstrap 4 ppt
 
Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]
 
Html and Xhtml
Html and XhtmlHtml and Xhtml
Html and Xhtml
 
WSO2 ESB Integration with REST
WSO2 ESB Integration with RESTWSO2 ESB Integration with REST
WSO2 ESB Integration with REST
 
Top frontend web development tools
Top frontend web development toolsTop frontend web development tools
Top frontend web development tools
 
Full stack devlopment using django main ppt
Full stack devlopment using django main pptFull stack devlopment using django main ppt
Full stack devlopment using django main ppt
 
JSON and XML
JSON and XMLJSON and XML
JSON and XML
 
Web Development
Web DevelopmentWeb Development
Web Development
 
Front-end development introduction (HTML, CSS). Part 1
Front-end development introduction (HTML, CSS). Part 1Front-end development introduction (HTML, CSS). Part 1
Front-end development introduction (HTML, CSS). Part 1
 
Routing in NEXTJS.pdf
Routing in NEXTJS.pdfRouting in NEXTJS.pdf
Routing in NEXTJS.pdf
 

Similaire à Crash Course on R Shiny Package

Web(abap introduction)
Web(abap introduction)Web(abap introduction)
Web(abap introduction)
Kranthi Kumar
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
Iblesoft
 
JOB PORTALProject SummaryTitle JOB-PORT.docx
JOB PORTALProject SummaryTitle    JOB-PORT.docxJOB PORTALProject SummaryTitle    JOB-PORT.docx
JOB PORTALProject SummaryTitle JOB-PORT.docx
christiandean12115
 

Similaire à Crash Course on R Shiny Package (20)

Shiny in R
Shiny in RShiny in R
Shiny in R
 
Guide to Using React Router V6 in React Apps.pdf
Guide to Using React Router V6 in React Apps.pdfGuide to Using React Router V6 in React Apps.pdf
Guide to Using React Router V6 in React Apps.pdf
 
Web(abap introduction)
Web(abap introduction)Web(abap introduction)
Web(abap introduction)
 
Api design part 1
Api design part 1Api design part 1
Api design part 1
 
Ttl
TtlTtl
Ttl
 
Ruby On Rails Siddhesh
Ruby On Rails SiddheshRuby On Rails Siddhesh
Ruby On Rails Siddhesh
 
Hugo resume
Hugo resumeHugo resume
Hugo resume
 
Overview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company indiaOverview of ASP.Net by software outsourcing company india
Overview of ASP.Net by software outsourcing company india
 
Tech Talk - Overview of Dash framework for building dashboards
Tech Talk - Overview of Dash framework for building dashboardsTech Talk - Overview of Dash framework for building dashboards
Tech Talk - Overview of Dash framework for building dashboards
 
A intro to (hosted) Shiny Apps
A intro to (hosted) Shiny AppsA intro to (hosted) Shiny Apps
A intro to (hosted) Shiny Apps
 
Christian Mladenov @ Intuitics
Christian Mladenov @ IntuiticsChristian Mladenov @ Intuitics
Christian Mladenov @ Intuitics
 
shiny.pdf
shiny.pdfshiny.pdf
shiny.pdf
 
Top 10 - ASP.NET Interview Questions And Answers 2023.pdf
Top 10 -  ASP.NET Interview Questions And Answers 2023.pdfTop 10 -  ASP.NET Interview Questions And Answers 2023.pdf
Top 10 - ASP.NET Interview Questions And Answers 2023.pdf
 
Asp.net architecture
Asp.net architectureAsp.net architecture
Asp.net architecture
 
Aspose pdf
Aspose pdfAspose pdf
Aspose pdf
 
GraphQL: The Missing Link Between Frontend and Backend Devs
GraphQL: The Missing Link Between Frontend and Backend DevsGraphQL: The Missing Link Between Frontend and Backend Devs
GraphQL: The Missing Link Between Frontend and Backend Devs
 
JOB PORTALProject SummaryTitle JOB-PORT.docx
JOB PORTALProject SummaryTitle    JOB-PORT.docxJOB PORTALProject SummaryTitle    JOB-PORT.docx
JOB PORTALProject SummaryTitle JOB-PORT.docx
 
Custom Development of Enterprise Services
Custom Development of Enterprise ServicesCustom Development of Enterprise Services
Custom Development of Enterprise Services
 
ruby-on-rails-and-ember-cli
ruby-on-rails-and-ember-cliruby-on-rails-and-ember-cli
ruby-on-rails-and-ember-cli
 
SAP Portal development technologies
SAP Portal development technologiesSAP Portal development technologies
SAP Portal development technologies
 

Plus de Rohit Dubey

Guide for a Data Scientist
Guide for a Data ScientistGuide for a Data Scientist
Guide for a Data Scientist
Rohit Dubey
 
Data Science Job ready #DataScienceInterview Question and Answers 2022 | #Dat...
Data Science Job ready #DataScienceInterview Question and Answers 2022 | #Dat...Data Science Job ready #DataScienceInterview Question and Answers 2022 | #Dat...
Data Science Job ready #DataScienceInterview Question and Answers 2022 | #Dat...
Rohit Dubey
 
Congrats ! You got your Data Science Job
Congrats ! You got your Data Science JobCongrats ! You got your Data Science Job
Congrats ! You got your Data Science Job
Rohit Dubey
 
Crack Data Analyst Interview Course
Crack Data Analyst Interview CourseCrack Data Analyst Interview Course
Crack Data Analyst Interview Course
Rohit Dubey
 
Data Analyst Project of Market Basket Analysis
Data Analyst Project of Market Basket AnalysisData Analyst Project of Market Basket Analysis
Data Analyst Project of Market Basket Analysis
Rohit Dubey
 
Business Analyst Job Interview
Business Analyst Job Interview Business Analyst Job Interview
Business Analyst Job Interview
Rohit Dubey
 
Data Analyst Job resume 2022
Data Analyst Job resume 2022Data Analyst Job resume 2022
Data Analyst Job resume 2022
Rohit Dubey
 
Business Analyst Job Course.pptx
Business Analyst Job Course.pptxBusiness Analyst Job Course.pptx
Business Analyst Job Course.pptx
Rohit Dubey
 
HbaseHivePigbyRohitDubey
HbaseHivePigbyRohitDubeyHbaseHivePigbyRohitDubey
HbaseHivePigbyRohitDubey
Rohit Dubey
 
Big Data PPT by Rohit Dubey
Big Data PPT by Rohit DubeyBig Data PPT by Rohit Dubey
Big Data PPT by Rohit Dubey
Rohit Dubey
 

Plus de Rohit Dubey (15)

DATA ANALYTICS INTRODUCTION
DATA ANALYTICS INTRODUCTIONDATA ANALYTICS INTRODUCTION
DATA ANALYTICS INTRODUCTION
 
Guide for a Data Scientist
Guide for a Data ScientistGuide for a Data Scientist
Guide for a Data Scientist
 
Data Science Job ready #DataScienceInterview Question and Answers 2022 | #Dat...
Data Science Job ready #DataScienceInterview Question and Answers 2022 | #Dat...Data Science Job ready #DataScienceInterview Question and Answers 2022 | #Dat...
Data Science Job ready #DataScienceInterview Question and Answers 2022 | #Dat...
 
Congrats ! You got your Data Science Job
Congrats ! You got your Data Science JobCongrats ! You got your Data Science Job
Congrats ! You got your Data Science Job
 
Crack Data Analyst Interview Course
Crack Data Analyst Interview CourseCrack Data Analyst Interview Course
Crack Data Analyst Interview Course
 
Data Analyst Project of Market Basket Analysis
Data Analyst Project of Market Basket AnalysisData Analyst Project of Market Basket Analysis
Data Analyst Project of Market Basket Analysis
 
Business Analyst Job Interview
Business Analyst Job Interview Business Analyst Job Interview
Business Analyst Job Interview
 
Data Analyst Job resume 2022
Data Analyst Job resume 2022Data Analyst Job resume 2022
Data Analyst Job resume 2022
 
Business Analyst Job Course.pptx
Business Analyst Job Course.pptxBusiness Analyst Job Course.pptx
Business Analyst Job Course.pptx
 
Machine Learning with Python made easy and simple
Machine Learning with Python  made easy and simple Machine Learning with Python  made easy and simple
Machine Learning with Python made easy and simple
 
Rohit Dubey Data Scientist Resume
Rohit Dubey Data Scientist Resume Rohit Dubey Data Scientist Resume
Rohit Dubey Data Scientist Resume
 
Data Scientist Rohit Dubey
Data Scientist Rohit DubeyData Scientist Rohit Dubey
Data Scientist Rohit Dubey
 
Best way of Public Speaking by Rohit Dubey (Treejee)
Best way of Public Speaking by Rohit Dubey (Treejee)Best way of Public Speaking by Rohit Dubey (Treejee)
Best way of Public Speaking by Rohit Dubey (Treejee)
 
HbaseHivePigbyRohitDubey
HbaseHivePigbyRohitDubeyHbaseHivePigbyRohitDubey
HbaseHivePigbyRohitDubey
 
Big Data PPT by Rohit Dubey
Big Data PPT by Rohit DubeyBig Data PPT by Rohit Dubey
Big Data PPT by Rohit Dubey
 

Dernier

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Dernier (20)

How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 

Crash Course on R Shiny Package

  • 1. Presents Quick Crash Course on R Package- Shiny
  • 2. R Package – Shiny Crash Course PRESENTS
  • 3. What is R shiny? A web application framework for R that allows you to turn your data into an interactive web App. You can easily integrate R with webpage. Suppose you want your web page run machine learning algorithms like random forest, SVM etc and display summary of the model with the flexibility of selecting inputs from user. Shiny can do it very easily.
  • 4. How does it work? Shiny apps have two components: - user interface script (controls layout and appearance by converting R code into HTML) - server script (contains the code needed to build the app)
  • 5. How does it work?
  • 6. How does it work? • ui - nested R functions that assemble an HTML user interface for your app • server - a function with instructions on how to build and rebuild the R objects displayed in the UI • shinyApp - combines ui and server into an app. Wrap with runApp() if calling from a sourced script or inside a function
  • 7. Do I need to know how to code in HTML? No knowledge of HTML, JavaScript or CSS is required. However, you can make your apps more interesting if you know some HTML codes. There are some excellent tutorials and lots of links for more information at http://shiny.rstudio.com/
  • 9. Getting Started: > install.packages("shiny") > library(shiny) > runApp("my_app") As a minimum, every shiny app has two R scripts (named ui and server) saved within the same directory (e.g. “my_app”).
  • 10. Getting Started: The fluidPage function allows the display to adjust automatically to the browser dimensions. The unnamed function contains the code needed to run the app.
  • 11. Getting Started: The fluidPage function allows the display to adjust automatically to the browser dimensions. The unnamed function contains the code needed to run the app. Other scripts (written in standard R code), libraries and data can be called by the server script if they are needed, using standard R commands above the shiny Server function.
  • 12. The User Interface (ui.R) A series of nested shiny functions control the layout of the content. sidebarLayout is a function with two compulsory arguments, both themselves functions (sidebarPanel and mainPanel). An optional argument controls the position of the panels. Text is written as a character string inside quotation marks. # ui.R shinyUI(fluidPage( titlePanel("title panel"), sidebarLayout(position = "right", sidebarPanel( "sidebar panel"), mainPanel("main panel") ) ))
  • 13. The User Interface (ui.R) # ui.R shinyUI(fluidPage( titlePanel("title panel"), sidebarLayout(position = "right", sidebarPanel( "sidebar panel"), mainPanel("main panel") ) ))
  • 14. Building an App : Complete the template by adding arguments to fluidPage() and a body to the server function :
  • 15. Building an App : Save your template as app.R. Alternatively, split your template into two files named ui.R and server.R.
  • 16. Adding Widgets Widgets are interactive web elements. A series of inbuild shiny functions allows widgets to be easily added to webpages. Each function has several arguments. It must have at least a name (used to access its value, but not visible) and a label (visible on the page). Both are character strings. Other arguments are widget specific.
  • 18. Examples – US Giant Stocks
  • 21. Why Shiny? Shiny is easy and powerful • You can make your analyses Shared, Live and explorable • It’s going to get more powerful - interactive graphics like d3 are coming • You can get support from the community and RStudio • Start coding - and show us what you can achieve
  • 22. Step 1 - Create New Web Shiny App
  • 23. Step 2 - Run App :
  • 24. So, Lets go practical ……..