This function collates the information needed for a matched pairs
analysis. Driver mortalities, with and without airabgs, are matched to
passenger mortalities for right front seat passengers in cars without
passenger airbags. It was used to generate the FARS and
FARSmiss datasets
matchedPairs(years = 2007:2008, prefix = "fars", compareBYvar = c("airbagAvail",
"airbagDeploy", "Restraint"),
bycat = list(airbagAvail = list(yes = c(1:9, 20, 28:29, 31:32), no =30,
leaveout = c(0, 98, 99)),
airbagDeploy = list(yes = c(1:9),
no = c(20, 28, 30:32), leaveout = c(0, 29, 98, 99)),
Restraint = list(yes = c(1:4, 8, 10:12, 97), no = c(0, 5, 6, 7, 13:17),
leaveout = (98:99))),
restrict = "body%in%c(1:19,48,49,61,62)&!(mhevent%in%(2:5))",
restrictvars = c("body", "mhevent", "seatpos", "injury"),
retain = c("state", "age", "airbag", "injury", "restraint",
"sex", "inimpact", "modelyr"), progress = TRUE)Years for which data is required
Prefix for file name.
Variables to be included in output, selected from airbagAvail,
airbagDeploy and Restraint), for which deaths are to
be compared between drivers (w/wo
Maps airbag and restraint codes to yes, no
or leaveout
Allows restriction of data to specified variable subsets.
character vector: names of variables that appear in the restrict
argument
Retain these columns in the output data
Print year by year details of the progress of calculations.
Data frame, with driver information matched against passenger information for the same vehicle
3-way table holding missing data information. The table
is has margins state, a set of
variable names, and years
This function is designed for processing data obtained from the FARS url
noted under references. This function was used to generate the data
in the FARS data frame. Two of the datasets from which
the FARS dataset was generated are included with this package
-- these are fars2007 and fars2008
plotFars, FARS, fars2007
# NOT RUN {
farsMatch0708 <- matchedPairs(years=2007:2008)
# }
Run the code above in your browser using DataLab