SlideShare a Scribd company logo
1 of 22
Download to read offline
Mark Sellors - Technical Architect
msellors@mango-solutions.com
APIs with R and plumber
Mark Sellors - Mango Solutions
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Me
• Technical Architect
• Data Engineering
• DataOps
• Analytic Maturity
• Automation
• Industrialisation
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Agenda
• API’s
• Introducing plumber
• How it works
• A simple case study
• Caveats
• Summary
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Data Science + API’s
are Changing the World
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Introducing plumber
http://plumber.trestletech.com
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Example - simple function
> adder <- function(a, b){
+ a + b
+ }
> adder(4, 3)
[1] 7
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Example - add plumber
#* @get /adder
> adder <- function(a, b){
+ as.numeric(a) + as.numeric(b)
+ }
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Example - running with plumber
> library(plumber)
> r <- plumb("my_api_file.R")
> r$run(port=8000)
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Example - Accessing the API
# curl http://localhost:8000/adder?a=4&b=3
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Demo 1 - Simple API
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Example - serving graphs
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Demo 2 - Tick API
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Why? What’s the point?
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Example - Shiny App
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Demo 3 - Currency Converter
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Moving beyond the shiny app
• split the application up
• turn the function into a general purpose
service
• refactor the shiny app to use the API
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Demo 4 - Currency API
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Caveats
Mark Sellors - Technical Architect
msellors@mango-solutions.com
When not to use plumber
• Shiny is a better for many users/uses
• It’s predominantly for API’s, not a full web
stack solution
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Extra things to consider...
• Security
• input sanitisation
• logging
• monitoring
• load balancing and state
• blocking
Mark Sellors - Technical Architect
msellors@mango-solutions.com
The Competition
RServe
OpenCPU
DeployR
Domino
Others?
Mark Sellors - Technical Architect
msellors@mango-solutions.com
Conclusion
Creating an API provides a simple
mechanism for exposing your functions to
other users.
Plumber provides a really simple way to
quickly create API’s using R

More Related Content

Viewers also liked

Viewers also liked (6)

Money, Sex and Evolution - Simulation and data analysis with Ruby and R
Money, Sex and Evolution - Simulation and data analysis with Ruby and RMoney, Sex and Evolution - Simulation and data analysis with Ruby and R
Money, Sex and Evolution - Simulation and data analysis with Ruby and R
 
R-Users Group JSON and ReST Introduction using Twitter
R-Users Group JSON and ReST Introduction using TwitterR-Users Group JSON and ReST Introduction using Twitter
R-Users Group JSON and ReST Introduction using Twitter
 
Ruby and R
Ruby and RRuby and R
Ruby and R
 
Rstudio in aws 16 9
Rstudio in aws 16 9Rstudio in aws 16 9
Rstudio in aws 16 9
 
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
 
26 Disruptive & Technology Trends 2016 - 2018
26 Disruptive & Technology Trends 2016 - 201826 Disruptive & Technology Trends 2016 - 2018
26 Disruptive & Technology Trends 2016 - 2018
 

Similar to Creating API's with R and plumber

adopt_soa.94145841
adopt_soa.94145841adopt_soa.94145841
adopt_soa.94145841
ypai
 
How to Build TOGAF Architectures With System Architect (2).ppt
How to Build TOGAF Architectures With System Architect (2).pptHow to Build TOGAF Architectures With System Architect (2).ppt
How to Build TOGAF Architectures With System Architect (2).ppt
StevenShing
 

Similar to Creating API's with R and plumber (20)

Cloud Computing, Grid Computing and Docker
Cloud Computing, Grid Computing and DockerCloud Computing, Grid Computing and Docker
Cloud Computing, Grid Computing and Docker
 
Best Practices in Testing Force.com Application
Best Practices in Testing Force.com ApplicationBest Practices in Testing Force.com Application
Best Practices in Testing Force.com Application
 
EAC Hunter Fan Presentation
EAC Hunter Fan PresentationEAC Hunter Fan Presentation
EAC Hunter Fan Presentation
 
Hunter Fan + EAC Presentation
Hunter Fan + EAC PresentationHunter Fan + EAC Presentation
Hunter Fan + EAC Presentation
 
Admin technology training nov 2007
Admin technology training   nov 2007Admin technology training   nov 2007
Admin technology training nov 2007
 
adopt_soa.94145841
adopt_soa.94145841adopt_soa.94145841
adopt_soa.94145841
 
Sika_APIForceMuleSoftMeetUp_5April2024.pdf
Sika_APIForceMuleSoftMeetUp_5April2024.pdfSika_APIForceMuleSoftMeetUp_5April2024.pdf
Sika_APIForceMuleSoftMeetUp_5April2024.pdf
 
Mc Laren V2 0
Mc Laren V2 0Mc Laren V2 0
Mc Laren V2 0
 
Scrum Prioritization Techniques Powerpoint Presentation Slides
Scrum Prioritization Techniques Powerpoint Presentation SlidesScrum Prioritization Techniques Powerpoint Presentation Slides
Scrum Prioritization Techniques Powerpoint Presentation Slides
 
Apache Spark and R: A (Big Data) Love Story?
Apache Spark and R: A (Big Data) Love Story?Apache Spark and R: A (Big Data) Love Story?
Apache Spark and R: A (Big Data) Love Story?
 
Scrum Prioritization Techniques PowerPoint Presentation Slides
Scrum Prioritization Techniques PowerPoint Presentation SlidesScrum Prioritization Techniques PowerPoint Presentation Slides
Scrum Prioritization Techniques PowerPoint Presentation Slides
 
How to Leverage SAFe 5.0 for Your Enterprise Cloud Strategy
How to Leverage SAFe 5.0 for Your Enterprise Cloud StrategyHow to Leverage SAFe 5.0 for Your Enterprise Cloud Strategy
How to Leverage SAFe 5.0 for Your Enterprise Cloud Strategy
 
BPM Application Infrastructure
BPM Application InfrastructureBPM Application Infrastructure
BPM Application Infrastructure
 
How to Build TOGAF Architectures With System Architect (2).ppt
How to Build TOGAF Architectures With System Architect (2).pptHow to Build TOGAF Architectures With System Architect (2).ppt
How to Build TOGAF Architectures With System Architect (2).ppt
 
Multi cloud webinar 2019 - slideshare
Multi cloud webinar 2019 - slideshareMulti cloud webinar 2019 - slideshare
Multi cloud webinar 2019 - slideshare
 
ARC's Sid Snitkin Asset Lifecycle Management @ ARC Industry Forum 2010
ARC's Sid Snitkin Asset Lifecycle Management @ ARC Industry Forum 2010ARC's Sid Snitkin Asset Lifecycle Management @ ARC Industry Forum 2010
ARC's Sid Snitkin Asset Lifecycle Management @ ARC Industry Forum 2010
 
Advantages of the Cloud_Q2_2017.pptx
Advantages of the Cloud_Q2_2017.pptxAdvantages of the Cloud_Q2_2017.pptx
Advantages of the Cloud_Q2_2017.pptx
 
Measure and increase developer productivity with help of Severless by Kazulki...
Measure and increase developer productivity with help of Severless by Kazulki...Measure and increase developer productivity with help of Severless by Kazulki...
Measure and increase developer productivity with help of Severless by Kazulki...
 
SP Tech Con San Francisco 2014 - Office 365 Information Architecture and Gove...
SP Tech Con San Francisco 2014 - Office 365 Information Architecture and Gove...SP Tech Con San Francisco 2014 - Office 365 Information Architecture and Gove...
SP Tech Con San Francisco 2014 - Office 365 Information Architecture and Gove...
 
Project Managment Plan V1.0 related to business.pptx
Project Managment Plan V1.0 related to business.pptxProject Managment Plan V1.0 related to business.pptx
Project Managment Plan V1.0 related to business.pptx
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Creating API's with R and plumber

  • 1. Mark Sellors - Technical Architect msellors@mango-solutions.com APIs with R and plumber Mark Sellors - Mango Solutions
  • 2. Mark Sellors - Technical Architect msellors@mango-solutions.com Me • Technical Architect • Data Engineering • DataOps • Analytic Maturity • Automation • Industrialisation
  • 3. Mark Sellors - Technical Architect msellors@mango-solutions.com Agenda • API’s • Introducing plumber • How it works • A simple case study • Caveats • Summary
  • 4. Mark Sellors - Technical Architect msellors@mango-solutions.com Data Science + API’s are Changing the World
  • 5. Mark Sellors - Technical Architect msellors@mango-solutions.com Introducing plumber http://plumber.trestletech.com
  • 6. Mark Sellors - Technical Architect msellors@mango-solutions.com Example - simple function > adder <- function(a, b){ + a + b + } > adder(4, 3) [1] 7
  • 7. Mark Sellors - Technical Architect msellors@mango-solutions.com Example - add plumber #* @get /adder > adder <- function(a, b){ + as.numeric(a) + as.numeric(b) + }
  • 8. Mark Sellors - Technical Architect msellors@mango-solutions.com Example - running with plumber > library(plumber) > r <- plumb("my_api_file.R") > r$run(port=8000)
  • 9. Mark Sellors - Technical Architect msellors@mango-solutions.com Example - Accessing the API # curl http://localhost:8000/adder?a=4&b=3
  • 10. Mark Sellors - Technical Architect msellors@mango-solutions.com Demo 1 - Simple API
  • 11. Mark Sellors - Technical Architect msellors@mango-solutions.com Example - serving graphs
  • 12. Mark Sellors - Technical Architect msellors@mango-solutions.com Demo 2 - Tick API
  • 13. Mark Sellors - Technical Architect msellors@mango-solutions.com Why? What’s the point?
  • 14. Mark Sellors - Technical Architect msellors@mango-solutions.com Example - Shiny App
  • 15. Mark Sellors - Technical Architect msellors@mango-solutions.com Demo 3 - Currency Converter
  • 16. Mark Sellors - Technical Architect msellors@mango-solutions.com Moving beyond the shiny app • split the application up • turn the function into a general purpose service • refactor the shiny app to use the API
  • 17. Mark Sellors - Technical Architect msellors@mango-solutions.com Demo 4 - Currency API
  • 18. Mark Sellors - Technical Architect msellors@mango-solutions.com Caveats
  • 19. Mark Sellors - Technical Architect msellors@mango-solutions.com When not to use plumber • Shiny is a better for many users/uses • It’s predominantly for API’s, not a full web stack solution
  • 20. Mark Sellors - Technical Architect msellors@mango-solutions.com Extra things to consider... • Security • input sanitisation • logging • monitoring • load balancing and state • blocking
  • 21. Mark Sellors - Technical Architect msellors@mango-solutions.com The Competition RServe OpenCPU DeployR Domino Others?
  • 22. Mark Sellors - Technical Architect msellors@mango-solutions.com Conclusion Creating an API provides a simple mechanism for exposing your functions to other users. Plumber provides a really simple way to quickly create API’s using R