Coder Social home page Coder Social logo

rpackage's Introduction

Building an R Package: Assignment 4

R-CMD-check

This package consists of a set of functions that explore a files containing counts of accidents information monthly, and yearly.

installation

To install this package copy and paste the following line into your R console.

library(devtools)
devtools::install_github("elssam/RPackage")

Alternatively, you can clone the github repo (manually or from the command line) and then run the following into your R console

devtools::load_all()

Setup

library(tidyr)
library(readr)
library(maps)
library(graphics)
library(magrittr)
library(dplyr)

Load all

Load all if you clone the package with devtools::load_all() or install the package from devtools (see Readme file for more details.) You will need to load knitr with library(knitr).

Reading files

The following This function takes a file name as an argument and checks if it exists before reading it as an R dataframe

fars_read("accident_2013.csv")

Reading files

The following function takes a file name as an argument and checks if it exists before reading it as an R dataframe

fars_read("accident_2013.csv")

Specify the file name

The following function takes as an argument the year for which the user wishes to acquire data and accordingly creates the associated file name

make_filename(2013)

Obtaining monthly information of accidents

This function takes a vector of years as an argument and provides a list, each element of the list is a data frame (corresponding to one element in the vector) with two columns, the \code{year} and \code{MONTH} that correspond to each accident

fars_read_years(c(2013,2014))

Summarizes number of accidents

The following function takes a vector of specific years as an argument and returns a summary of the count (e.g. fatal injuries in motor vehicle traffic crashes) per month within the years provided

fars_summarize_years(c(2013,2014))

Plot a map of accidents

This function plots a map of accidents' locations which occurred within a specified year in a given state.

fars_map_state('34',2013)

rpackage's People

Contributors

elssam avatar

Watchers

James Cloos avatar  avatar

Forkers

fishcounter

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.