Skip to content

leoschet/accidents

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Accidents / ET586CC

Source

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.

Tools and dependencies

You may find it worth to use the RStudio IDE (Integrated Development Environment).

Web-available demo

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.

Deploying

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.

Possible simple improvements

  • lib.R code could be more organized
  • Interval functions options could be dynamically added to the UI
  • Server.R has linting problems
  • Caching

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.

Docs

Contributing

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.

Authors

License

Licensed under the MIT license.

About

Statistics project theme: workplace accidents in Brazil.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • R 100.0%