Coder Social home page Coder Social logo

anhdanggit / fars Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.49 MB

Functions to summarize fatal accidents datasets in 2013-15 (30,000+ obs./year) and plot the locations on state maps. Data Source: US National Highway Traffic Safety Administration's Data

License: GNU General Public License v2.0

R 100.00%
cleaning data accident data-frame plot map

fars's Introduction

fars

Functions of Analyze Fatality Accidents Data

Author: "Anh Dang (assignment from Coursera)"

Travis Badge

Build Status

Package Info

This is the instruction for all related functions included in fars package to assess and analyze the data from the US National Highway Traffic Safety Administration's Data, including:

  • fars_read: to take the table format data and create a data frame
  • make_filename: to create a valid name of data by inputed year
  • fars_read_years: to months having fatal accidents by months
  • fars_summarize_years: to summarize the number of fatal accidents by months and years
  • fars_map_state: to plots the locations of accidents of a state in a specific year by longtitude and latitude

Data Info

The functions applied to the data from using data from the US National Highway Traffic Safety Administration's Fatality Analysis Reporting System, which is a nationwide census providing the American public yearly data regarding fatal injuries suffered in motor vehicle traffic crashes.

The package includes the data in 2013, 2014, 2015, named accident_2013.csv.bz2, accident_2014.csv.bz2, accident_2015.csv.bz2 respectively

(1) fars_read

Functions fars_read reads a file with filename in table format to create the data frame.

fars::fars_read("accident_2013.csv.bz2")

(2) make_filename

Function make_filename takes an year and create a filename in the format of "accident_year.csv.bz2"

fars::make_filename(2014)

(3) fars_read_years

Function fars_read_years takes a list of years and return the data of specific years, which only remains the variables of MONTH and year. It returns NULL if inputing invalid years.

library(dplyr)
fars::fars_read_years(c(2012, 2013))

(4) fars_summarize_years

Function fars_summarize_years summarizes the number of fatal accidents in each year by MONTH.

(5) fars_map_state

The figure sizes have been customised so that you can easily put two images side-by-side.

library(graphics)
library(maps)
fars::fars_map_state(1,2014)

fars's People

Contributors

anhdanggit avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.