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 http://spark.rstudio.com/marqui/breastcancer/



Shiny package


Shiny is a new package created by RStudio (http://www.rstudio.com/shiny/) 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 http://spark.rstudio.com/marqui/breastcancer/

29 comments:

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

    ReplyDelete
  2. Thanks a lot for one’s intriguing write-up. It’s actually exceptional. Searching ahead for this sort of revisions.
    https://asbestoscancer.org/epithelioid-mesothelioma/

    ReplyDelete
  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. ซิลิโคนหลังผ่าตัดเต้าน

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

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

    ReplyDelete
  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


    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

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

    ReplyDelete
  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

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

    ReplyDelete
  15. Replenish 360 offers one of the most affordable wellness and preventative services that are personalized and one of the most activating one-of-a-kind IV drip and infusions, vitamin and antioxidant supplementation, micronutrient therapy, and other additional supplementary wellness services to “renew your body, refresh your mind, and restore performance.” IV Therapy Palm Springs

    ReplyDelete
  16. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me. brand identity design company

    ReplyDelete
  17. These are some great tools that i definitely use for SEO work. This is a great list to use in the future.. buy likes cheap

    ReplyDelete
  18. This article is to help you find some of the best weight loss supplements available. how to weight loss fast

    ReplyDelete
  19. Yes, I am entirely agreed with this article, and I just want say that this article is very helpful and enlightening. I also have some precious piece of concerned info !!!!!!Thanks. veja aqui como baixar Lulubox atualizado

    ReplyDelete