Sep 14, 2013

My first R Shiny Web Application using breast cancer data

I love the idea of making non-R users playing with my datasets. Thanks to R Shiny package this is is now possible and I am going to post here my code for a simple web application.

But first a few lines about Shiny package and my dataset. Okay…if you are in a hurry and want to go straight to check my app, here is the link

Shiny package

Shiny is a new package created by RStudio ( that makes it very easy to build interactive web applications with R. Yes, that means that anyone can use it, interact with your data and gain insights from your analysis results.

The dataset & my app

The web application I’ve built allows you to explore and visualize data about new cases of breast cancer across countries. The app is quite simple: you first select the continent you are interest in, and you get:
  1. a table of countries sorted from the highest breast cancer rate to the lowest
  2. a world map with data plotted over it

My dataset includes breast cancer data for 174 countries and it was originally collected by ARC (International Agency for Research on Cancer) in 2002. Actually my dataset includes also several other socio-economic variables (which I am not going to explore in this occasion) and went through a previous “cleaning stage” where I added further variables. Check my previous post for more info on that how to plot data over a map with R.   

My code

To build a Shiny app you need to create two separate components (scripts): a user interface definition and a server script. The first is named ui.R and the latter server.R ; bot must be located in the same folder (your shiny app directory). Finally, to run it, you need to first make sure you are pointing to your app directory and execute these commands:

> library (shiny) # to load the shiny library

> runApp() # or runApp(“location of your app folder”) if that is not set as your working directory

Here below are my scripts for the user interface and server components. Oh yes, if you have not clicked yet on the link above, again this is the link where you can access my app


  1. Is it okay to post part of this on my website basically post a hyperlink to this webpage? epithelioid tissue

  2. Thanks a lot for one’s intriguing write-up. It’s actually exceptional. Searching ahead for this sort of revisions.

  3. I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post. Hats off to you! The information that you have provided is very helpful. ซิลิโคนหลังผ่าตัดเต้าน

  4. Most man-made brainpower frameworks out there can just deal with this undertaking as it applies to constrained subjects.
    ai courses

  5. Profit primarily prime quality items -- you can understand them all within: Tumors

  6. A IEEE project is an interrelated arrangement of exercises, having a positive beginning and end point and bringing about an interesting result in Engineering Colleges for a particular asset assignment working under a triple limitation - time, cost and execution. Final Year Project Domains for CSE In Engineering Colleges, final year IEEE Project Management requires the utilization of abilities and information to arrange, plan, plan, direct, control, screen, and assess a final year project for cse. The utilization of Project Management to accomplish authoritative objectives has expanded quickly and many engineering colleges have reacted with final year IEEE projects Project Centers in Chennai for CSE to help students in learning these remarkable abilities.

    Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining the authors explore the idea of using Java in Big Data platforms.
    Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai

  7. They run pink gatherings and offer pink items so as to fund-raise. Numerous organizations partake and do exceptional advancements during October for their favored philanthropy. "Pink" is huge business.
    Breast Cancer

  8. Very informative post ! There is a lot of information here that can help any business get started with a successful social networking campaign ! Latest & Bugs Free Version

  9. Hi to everybody, here everyone is sharing such knowledge, so it’s fastidious to see this site, and I used to visit this blog daily Latest & Updated Version

  10. Great tips and very easy to understand. This will definitely be very useful for me when I get a chance to start my blog. Tubemate APK Here Download Latest & Updated File

  11. Very nice blog and articles. I am realy very happy to visit your blog. Now I am found which I actually want. I check your blog everyday and try to learn something from your blog. Thank you and waiting for your new post. Tubidy APK 2020 Download Free Latest and Update

  12. I really like your writing style, great information, thankyou for posting. logo inspiration

  13. it was a wonderful chance to visit this kind of site and I am happy to know. thank you so much for giving us a chance to have this opportunity.. design

  14. New web site is looking good. Thanks for the great effort. design