Friday, 29 November 2013

Introducing CrimeMap - A Web App Powered by ShinyApps!

A few months ago I did a mini project using open crime data and R to create crime visualisations. At that time, I was already thinking about a web app using Shiny but I couldn't justify the time to develop the app and then set up a server etc. Not until two weeks ago when I received an invitation to join the alpha testing of ShinyApps.


ShinyApps - A Wonderful Discovery

I went through the ShinyApps' getting started guide. Everything looks pretty straight forward. So I decided to go ahead and moved my codes from the crime visualisation project to a new ShinyApps project. The progress was unexpectedly smooth. Given that I had no web application development experience prior to this mini exercise, I consider this a quick success! All credit goes to the RStudio team for providing these tools and hosting services (especially Tareef Kawaf who kindly answered all my questions). I would summarise the whole process in the following few steps:
  1. Sign up for a ShingApps alpha testing account here (you will need a Google account).
  2. Install packages shiny and shinyapps (click on the links for installation help).
  3. Sign in to my.shinyapps.io, give your ShinyApps account a name ("blenditbayes" in my case) and get your application token/secret.
  4. Go through the tutorials, create the ui.R and server.R scripts for your app.
  5. Test the app locally using runApp().
  6. Once you're happy with the app, apply your token/secret and deploy your app using deployApp().
That's it! I can focus my effort solely on developing the app. The rest has been taken care of and simplified by the deployApp() and other ShinyApps functions.
 

CrimeMap in Action

So here is my first ever web app "CrimeMap" powered by ShinyApps! I will go through the usage briefly in the following sections. I hope you can give it a try and give me some feedback (e.g. what features are missing?) so I can continue to improve it. Your comments will be valuable to the ShinyApps development team too.

Basic Usage

First, enter a location of your choice (e.g. London) within England, Wales and Northern Ireland. Select the first month of crime data collection and then the length of the analysis period. After that, click on the "Update" button. My experience is that the graphs should come up within a minute if the length of analysis is less than or equal to 6 months. Depending on the location and the length of analysis, the process might take longer (say a couple minutes). The outputs (at the time of writing) are displayed in three tabs: Data, Crime Map and Trends. The Data tab shows the original crime data records downloaded from the data.police.uk (I may add a feature like "download as CSV in future). The crime map is a density plot of the crime data. Finally, the trends tab shows bar charts of crime records over time in different crime categories. Right click on the map and you can save the image in its original size (1280 x 1280).




Customise the Maps

Continue to scroll down the menu on the left, you will find more settings for the map. Change the facet settings to create map facets according to crime type, categories and month. You can select different Google map format (roadmap, satellite, hybrid or terrain). There are also options to download the Google map image in high resolution (it takes a bit longer), in black & white and at various zoom levels. When you click the "Update" button to refresh the maps, it may take a while to show the new graphs if you have lots of facets.



Fine-tuning the Density Plots

The Density Plot Settings allow user to modify the "behind the scenes" ggplot2 codes. You can modify the layer transparency (alpha range), the number of bins, the width and the colour of the boundary lines as well as the colours of the gradient. My hope is to develop a user-friendly interface that allows users to quickly create maps with their own favourite themes. Surely, ggplot2 is much more powerful than that and has a lot more settings available. What other settings would you like to see here? Please let me know.



Exploring the Trends

Why am I including the trends visualisation? It just happened that I read this article around the same time I received the ShinyApps invitation. As I had already coded something for crime data visualisation, I thought it would be interesting to look at the data myself. So here is a handy tool for you to explore and to visualise the data with a few clicks. I will leave you with your own conclusions.



Feedback Please

As I mentioned above, I am new to web app development and this is my first ever experiment. Please have a go, create a few maps and let me know what can be done better. Thanks in advance!! All the codes are available here.

39 comments:

  1. Thanks for sharing this article...
    Leanpitch provides online training in Advanced Scrum Master during this lockdown period everyone can use it wisely.
    Advanced Scrum Master Training Online

    ReplyDelete
  2. Thanks for sharing this informative content , Great work
    To crack scrum master interview : Scrum Master Interview Questions

    ReplyDelete
  3. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Scrum Master during this lockdown period everyone can use it wisely.
    Scrum Master Certification online

    ReplyDelete
  4. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Scrum Master during this lockdown period everyone can use it wisely.
    CSM online

    ReplyDelete
  5. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Scrum Master during this lockdown period everyone can use it wisely.
    Advanced Scrum Master Training

    ReplyDelete
  6. Thanks for sharing this informative content , Great work
    To crack scrum master interview : Scrum Master Interview Questions

    ReplyDelete
  7. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Scrum Master during this lockdown period everyone can use it wisely.
    CSM online certification

    ReplyDelete
  8. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Scrum Master during this lockdown period everyone can use it wisely.
    CSM training online

    ReplyDelete
  9. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Advanced Scrum Master during this lockdown period everyone can use it wisely.
    Advanced CSM training online

    ReplyDelete
  10. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Coaching agile transitions during this lockdown period everyone can use it wisely.
    Coaching agile transitions

    ReplyDelete
  11. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Devops during this lockdown period everyone can use it wisely.
    Devops Online Training

    ReplyDelete
  12. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Product prototyping during this lockdown period everyone can use it wisely.
    Product Prototyping

    ReplyDelete
  13. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Product prototyping during this lockdown period everyone can use it wisely.
    icp-cat training

    ReplyDelete
  14. Thanks for sharing this informative content , Great work
    Read this PSM vs CSM blog from Leanpitch to get a better conclusion : PSM vs CSM

    ReplyDelete
  15. Thanks for sharing this informative content , Great work
    Leanpitch provides crash course in Conducting User Interview during this lockdown period everyone can use it wisely
    Conducting user interview

    ReplyDelete
  16. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Devops during this lockdown period everyone can use it wisely.
    Devops Online Training

    ReplyDelete
  17. Thanks for sharing this informative content , Great work
    Read this Blog to become a perfect Product Manager : Best Books for Product managers

    ReplyDelete
  18. Thanks for sharing this informative content , Great work
    Read this Blog to know about Scrum artifacts : Scrum Artifacts

    ReplyDelete
  19. Thanks for sharing this informative content , Great work
    Devops Online Training
    Leanpitch provides online training in Devops during this lockdown period everyone can use it wisely.

    ReplyDelete
  20. Thanks for sharing this informative content , Great work
    Devops Online Training
    Leanpitch provides online training in Devops during this lockdown period everyone can use it wisely.

    ReplyDelete
  21. Thanks for sharing this informative content , Great work
    To crack Agile coach interview : Agile coach interview questions

    ReplyDelete
  22. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in Enterprise Agile coaching during this lockdown period everyone can use it wisely.
    Enterprise Agile Coaching

    ReplyDelete
  23. Thanks for sharing this informative content , Great work
    Leanpitch provides online certification in scrum master during this lockdown period everyone can use it wisely.
    Scrum master certification

    ReplyDelete
  24. Thanks for sharing this informative content , Great work
    Leanpitch provides online certification in Enterprise agile coaching during this lockdown period everyone can use it wisely.
    Enterprise Agile Coaching

    ReplyDelete
  25. Thanks for sharing this informative content , Great work
    Leanpitch provides online training in devops during this lockdown period everyone can use it wisely.
    Devops Online Training

    ReplyDelete
  26. Thanks for sharing this.,
    Leanpitch provides online training in Scrum Master during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSM Certification Workshop in different cities.

    scrum master certification cost

    ReplyDelete
  27. Thanks for sharing this.,
    Leanpitch provides online training in CSPO during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSPO Certification Workshop in different cities.

    Product owner certification

    ReplyDelete
  28. Thanks for sharing this informative content.,
    Leanpitch provides online training in Scrum Master Certifiation during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSM Certification Workshop in different cities.

    Scrum master certification online

    CSM certification online

    ReplyDelete
  29. Thanks for sharing this.,
    Leanpitch provides online training in CSPO during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSPO Certification Workshop in different cities.

    CSPO certification

    Product owner certification

    ReplyDelete
  30. Thanks for sharing this.,
    Leanpitch provides online training in CSPO during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSPO Certification Workshop in different cities.

    CSPO certification online

    Certified scrum product owner

    ReplyDelete
  31. Thanks for sharing this.,
    Leanpitch provides online training in CSPO during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSPO Certification Workshop in different cities.
    CSPO online certification

    CSPO certification cost

    ReplyDelete
  32. Thanks for sharing this.,
    Leanpitch provides online training in CSPO during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSPO Certification Workshop in different cities
    CSPO TRAINING ONLINE

    CSPO ONLINE TRAINING

    ReplyDelete
  33. Thanks for sharing this.,
    Leanpitch provides online training in CSPO during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSPO Certification Workshop in different cities
    CSPO TRAINING

    CSPO ONLINE

    ReplyDelete

  34. Thanks for sharing this.,
    Leanpitch provides crash course in Brain hacks using NLP everyone can use it wisely.

    Brain hacks with NLP

    NLP training

    ReplyDelete
  35. Thanks for sharing this.,
    Leanpitch provides crash course in Brain hacks using NLP everyone can use it wisely.
    NLP training

    NLP crash course

    ReplyDelete


  36. Thanks for sharing this.,
    Leanpitch provides crash course in Facilitating change everyone can use it wisely.

    Reducing barrier for change

    Facilitating change

    ReplyDelete
  37. Thanks for sharing this.,
    Leanpitch provides crash course in Facilitating change everyone can use it wisely.

    Facilitating change

    Facilitating change in the workplace

    ReplyDelete

  38. Thanks for sharing this informative content.,
    Turient is an All-in-one platform for all our teaching needs. If Teaching is your passion ,enabling is ours
    Read the Informative blog - 11 Free Teaching Tools for Online Teachers

    11 Free Teaching Tools for Online Teachers
    Free Teaching Tools

    ReplyDelete
  39. Thanks for sharing this informative content.,
    Leanpitch provides online training in Agile team facilitation during this lockdown period everyone can use it wisely.

    Agile team facilitation

    ICP ATF

    ReplyDelete