In: Statistics and Probability
"Accident" in R package vcdExtra gives a 4-way table of frequencies of traffic accident victims in France in 1958. See: help(Accident, package="vcdExtra")
I want to create a binomial distribution with the response variable "result" (died or injured). In particular, I want to create a one-way frequency table with:
-age and frequency of injured
-mode and frequency of injured
-age and frequency of died
-mode and frequency of died
What is the code for making a one-way frequency table?
R code
------
install.packages('vcdExtra')
library(vcdExtra)
head(Accident)
#-age and frequency of injured
aggregate(Freq ~ age, subset(Accident,result=="Injured"), sum)
#-mode and frequency of injured
aggregate(Freq ~ mode, subset(Accident,result=="Injured"), sum)
#-age and frequency of died
aggregate(Freq ~ age, subset(Accident,result=="Died"), sum)
#-mode and frequency of died
aggregate(Freq ~ mode, subset(Accident,result=="Died"), sum)
---------
#get these