This is common to any number of data.frames:
library(functional)
Reduce(Curry(merge, by = "city", all = TRUE), list(df1, df2, df3))
. :
df.long <- do.call(rbind, Map(transform, list(df1, df2, df3),
name = c("df1", "df2", "df3")))
# city injuries name
# 1 atlanta 5 df1
# 2 new york 8 df1
# 3 chicago 2 df2
# 4 new york 3 df2
# 5 los angeles 1 df3
# 6 atlanta 7 df3
xtabs, :
xtabs(injuries ~ city + name, df.long)
# name
# city df1 df2 df3
# atlanta 5 0 7
# new york 8 3 0
# chicago 0 2 0
# los angeles 0 0 1
( reshape , .)