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