Accidents / ET586CC
Source: Anuário Estatístico de Acidentes de Trabalho - AEAT
Project theme: workplace accidents in Brazil.
data/accidents-compiled.csv has data compiled between the 2002-2009 period.
- R runtime >= 3.1.1
- Shiny by RStudio: A web application framework for R
- visualization-tools: for plotting t-test
You may find it worth to use the RStudio IDE (Integrated Development Environment).
Before downloading the app you can try it on-line at http://henvic.shinyapps.io/accidents/
Shiny uses a web-based UI with WebSocket to sync it with the R logic on the server-side.
App kindly hosted for free at the ShinyApps.io cloud.
You can fast deploy this program in a just few seconds with
R -e "shiny::runGitHub('accidents', 'henvic');"
This will download the last version of the program and run it.
- lib.R code could be more organized
- Interval functions options could be dynamically added to the UI
- Server.R has linting problems
- Caching
The code doesn't cache almost anything because the tradeoff would be code quality and the benefits weren't enough to justify it, even thought when loading the 2002-2009 dataset we can notice there's a evident bottleneck.
The caching decision was deferred and, then, once complete, deferred indefinitely.
We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. ~ Donald Knuth
The parsing of the CSV file with the construction of the raw data table seems to be one of the most costly operations but no statistics were taken to prove this claim.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using the R lint package.
Read the Google's R Style Guide and try to follow it.
If you're new to git and GitHub see the GitHub Guides.
Licensed under the MIT license.