Let's Load the package into namespace. We'll also need the stats
and maps
packages:
library(fars) library(stats) library(maps)
Now I can read in one of the data files using the fars_read()
function from the package:
df_2013 <- fars_read('data/accident_2013.csv.bz2')
This gives 30202 observations of 50 variables. Using a different function from fars
, I could
have also created the filename automatically:
file_name <- make_filename(2013) data_path <- file.path('data/accident_2013.csv.bz2')
You can also input multiple years:
multiyear <- fars_read_years(c(2013,2015))
Or summarize multiple years:
fars_summarize_years(c(2013,2014))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.