Skip to content

Instantly share code, notes, and snippets.

@ckholmes5
Created August 4, 2016 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ckholmes5/c9b929adc0f1bef65b3987a0c1c3d863 to your computer and use it in GitHub Desktop.
Save ckholmes5/c9b929adc0f1bef65b3987a0c1c3d863 to your computer and use it in GitHub Desktop.
years = c(1999, 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014)
df = data.frame()
for (year in years) {
df1 = read.sas7bdat(paste('FARS ', year, '/acc_aux.sas7bdat', sep=''))
print(year)
if (year > 2012) {
drops = c('A_PEDAL_F', 'A_PED_F')
df1 = df1[, !(names(df1) %in% drops)]
}
df = rbind(df, df1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment