Homework #1 is worth 100 points and each question is worth 6.5 points each.
Submission Instructions: save the .HTML file as ‘Familiar_ Categorical_Data_Assignmentyourlastname.HTML’ and upload the HTML file to the assignment entitled ‘Getting Familiar with Categorical Data in R’ on Canvas on or before Thursday April 02, 2020 by 11:59p.m. EST. No late assignments are accepted.
Run the code chunk below.
library(vcd)
## Warning: package 'vcd' was built under R version 3.6.3
## Loading required package: grid
library(grid)
library(gnm)
## Warning: package 'gnm' was built under R version 3.6.3
library(vcdExtra)
## Warning: package 'vcdExtra' was built under R version 3.6.3
ds <- datasets(package = c("vcd", "vcdExtra"))
str(ds, vec.len=2)
## 'data.frame': 76 obs. of 5 variables:
## $ Package: chr "vcd" "vcd" ...
## $ Item : chr "Arthritis" "Baseball" ...
## $ class : chr "data.frame" "data.frame" ...
## $ dim : chr "84x5" "322x25" ...
## $ Title : chr "Arthritis Treatment Data" "Baseball Data" ...
head(ds)
## Package Item class dim
## 1 vcd Arthritis data.frame 84x5
## 2 vcd Baseball data.frame 322x25
## 3 vcd BrokenMarriage data.frame 20x4
## 4 vcd Bundesliga data.frame 14018x7
## 5 vcd Bundestag2005 table 16x5
## 6 vcd Butterfly table 24
## Title
## 1 Arthritis Treatment Data
## 2 Baseball Data
## 3 Broken Marriage Data
## 4 Ergebnisse der Fussball-Bundesliga
## 5 Votes in German Bundestag Election 2005
## 6 Butterfly Species in Malaya
head(UCBAdmissions)
## [1] 512 313 89 19 353 207
str(UCBAdmissions)
## 'table' num [1:2, 1:2, 1:6] 512 313 89 19 353 207 17 8 120 205 ...
## - attr(*, "dimnames")=List of 3
## ..$ Admit : chr [1:2] "Admitted" "Rejected"
## ..$ Gender: chr [1:2] "Male" "Female"
## ..$ Dept : chr [1:6] "A" "B" "C" "D" ...
ds
## Package Item class dim
## 1 vcd Arthritis data.frame 84x5
## 2 vcd Baseball data.frame 322x25
## 3 vcd BrokenMarriage data.frame 20x4
## 4 vcd Bundesliga data.frame 14018x7
## 5 vcd Bundestag2005 table 16x5
## 6 vcd Butterfly table 24
## 7 vcd CoalMiners table 2x2x9
## 8 vcd DanishWelfare data.frame 180x5
## 9 vcd Employment table 2x6x2
## 10 vcd Federalist table 7
## 11 vcd Hitters data.frame 154x4
## 12 vcd HorseKicks table 5
## 13 vcd Hospital table 3x3
## 14 vcd JobSatisfaction data.frame 8x4
## 15 vcd JointSports data.frame 40x5
## 16 vcd Lifeboats data.frame 18x8
## 17 vcd MSPatients array 4x4x2
## 18 vcd NonResponse data.frame 12x4
## 19 vcd OvaryCancer data.frame 16x5
## 20 vcd PreSex table 2x2x2x2
## 21 vcd Punishment data.frame 36x5
## 22 vcd RepVict table 8x8
## 23 vcd Rochdale table 2x2x2x2x2x2x2x2
## 24 vcd Saxony table 13
## 25 vcd SexualFun table 4x4
## 26 vcd SpaceShuttle data.frame 24x6
## 27 vcd Suicide data.frame 306x6
## 28 vcd Trucks data.frame 24x5
## 29 vcd UKSoccer table 5x5
## 30 vcd VisualAcuity data.frame 32x4
## 31 vcd VonBort data.frame 280x4
## 32 vcd WeldonDice table 11
## 33 vcd WomenQueue table 11
## 34 vcdExtra Abortion table 2x2x2
## 35 vcdExtra Accident data.frame 80x5
## 36 vcdExtra AirCrash data.frame 439x5
## 37 vcdExtra Alligator data.frame 80x5
## 38 vcdExtra Bartlett table 2x2x2
## 39 vcdExtra Burt data.frame 36x5
## 40 vcdExtra Caesar table 3x2x2x2
## 41 vcdExtra Cancer table 2x2x2
## 42 vcdExtra Cormorants data.frame 343x8
## 43 vcdExtra CyclingDeaths data.frame 208x2
## 44 vcdExtra DaytonSurvey data.frame 32x6
## 45 vcdExtra Depends table 15
## 46 vcdExtra Detergent table 2x2x2x3
## 47 vcdExtra Donner data.frame 90x5
## 48 vcdExtra Draft1970 data.frame 366x3
## 49 vcdExtra Draft1970table table 12x3
## 50 vcdExtra Dyke table 2x2x2x2x2
## 51 vcdExtra Fungicide array 2x2x2x2
## 52 vcdExtra GSS data.frame 6x3
## 53 vcdExtra Geissler data.frame 90x4
## 54 vcdExtra Gilby table 6x4
## 55 vcdExtra Glass data.frame 25x3
## 56 vcdExtra HairEyePlace array 4x5x2
## 57 vcdExtra Hauser79 data.frame 25x3
## 58 vcdExtra Heart table 2x2x3
## 59 vcdExtra Heckman table 2x2x2x2x2
## 60 vcdExtra HospVisits table 3x3
## 61 vcdExtra Hoyt table 4x3x7x2
## 62 vcdExtra ICU data.frame 200x22
## 63 vcdExtra JobSat table 4x4
## 64 vcdExtra Mammograms matrix 4x4
## 65 vcdExtra Mental data.frame 24x3
## 66 vcdExtra Mice data.frame 30x4
## 67 vcdExtra Mobility table 5x5
## 68 vcdExtra PhdPubs data.frame 915x6
## 69 vcdExtra ShakeWords data.frame 100x2
## 70 vcdExtra TV array 5x11x3
## 71 vcdExtra Titanicp data.frame 1309x6
## 72 vcdExtra Toxaemia data.frame 60x5
## 73 vcdExtra Vietnam data.frame 40x4
## 74 vcdExtra Vote1980 data.frame 28x4
## 75 vcdExtra WorkerSat data.frame 8x4
## 76 vcdExtra Yamaguchi87 data.frame 75x4
## Title
## 1 Arthritis Treatment Data
## 2 Baseball Data
## 3 Broken Marriage Data
## 4 Ergebnisse der Fussball-Bundesliga
## 5 Votes in German Bundestag Election 2005
## 6 Butterfly Species in Malaya
## 7 Breathlessness and Wheeze in Coal Miners
## 8 Danish Welfare Study Data
## 9 Employment Status
## 10 'May' in Federalist Papers
## 11 Hitters Data
## 12 Death by Horse Kicks
## 13 Hospital data
## 14 Job Satisfaction Data
## 15 Opinions About Joint Sports
## 16 Lifeboats on the Titanic
## 17 Diagnosis of Multiple Sclerosis
## 18 Non-Response Survey Data
## 19 Ovary Cancer Data
## 20 Pre-marital Sex and Divorce
## 21 Corporal Punishment Data
## 22 Repeat Victimization Data
## 23 Rochdale Data
## 24 Families in Saxony
## 25 Sex is Fun
## 26 Space Shuttle O-ring Failures
## 27 Suicide Rates in Germany
## 28 Truck Accidents Data
## 29 UK Soccer Scores
## 30 Visual Acuity in Left and Right Eyes
## 31 Von Bortkiewicz Horse Kicks Data
## 32 Weldon's Dice Data
## 33 Women in Queues
## 34 Abortion Opinion Data
## 35 Traffic Accident Victims in France in 1958
## 36 Air Crash Data
## 37 Alligator Food Choice
## 38 Bartlett data on plum root cuttings
## 39 Burt (1950) Data on Hair, Eyes, Head and Stature
## 40 Risk Factors for Infection in Caesarian Births
## 41 Survival of Breast Cancer Patients
## 42 Advertising Behavior by Males Cormorants
## 43 London Cycling Deaths
## 44 Dayton Student Survey on Substance Use
## 45 Dependencies of R Packages
## 46 Detergent preference data
## 47 Survival in the Donner Party
## 48 USA 1970 Draft Lottery Data
## 49 USA 1970 Draft Lottery Table
## 50 Sources of Knowledge of Cancer
## 51 Carcinogenic Effects of a Fungicide
## 52 General Social Survey- Sex and Party affiliation
## 53 Geissler's Data on the Human Sex Ratio
## 54 Clothing and Intelligence Rating of Children
## 55 British Social Mobility from Glass(1954)
## 56 Hair Color and Eye Color in Caithness and Aberdeen
## 57 Hauser (1979) Data on Social Mobility
## 58 Sex, Occupation and Heart Disease
## 59 Labour Force Participation of Married Women 1967-1971
## 60 Hospital Visits Data
## 61 Minnesota High School Graduates
## 62 ICU data set
## 63 Cross-classification of job satisfaction by income
## 64 Mammogram Ratings
## 65 Mental impariment and parents SES
## 66 Mice Depletion Data
## 67 Social Mobility data
## 68 Publications of PhD Candidates
## 69 Shakespeare's Word Type Frequencies
## 70 TV Viewing Data
## 71 Passengers on the Titanic
## 72 Toxaemia Symptoms in Pregnancy
## 73 Student Opinion about the Vietnam War
## 74 Race and Politics in the 1980 Presidential Vote
## 75 Worker Satisfaction Data
## 76 Occupational Mobility in Three Countries
nrow(ds)
## [1] 76
ds_vcd <- datasets(package = "vcd")
ds_vcdExtra <- datasets(package = "vcdExtra")
nrow(ds_vcd)
## [1] 33
nrow(ds_vcdExtra)
## [1] 43
## There are 76 data sets in total. 33 in package vcd. And 43 in package vcdExtra
table(ds$Package, ds$class)
##
## array data.frame matrix table
## vcd 1 17 0 15
## vcdExtra 3 24 1 15
help(Butterfly)
## starting httpd help server ... done
example(Butterfly)
##
## Bttrfl> data("Butterfly")
##
## Bttrfl> Ord_plot(Butterfly)
help(BrokenMarriage)
example(BrokenMarriage)
##
## BrknMr> data("BrokenMarriage")
##
## BrknMr> structable(~ ., data = BrokenMarriage)
## rank I II III IV V
## gender broken
## male yes 14 39 42 79 66
## no 102 151 292 293 261
## female yes 12 23 37 102 58
## no 25 79 151 557 321
sum(UCBAdmissions)
## [1] 4526
margin.table(UCBAdmissions,3)
## Dept
## A B C D E F
## 933 585 918 792 584 714
ucb <-as.data.frame(UCBAdmissions)
ucb_cont <- xtabs(Freq~Dept + Admit, data = ucb)
prop.table(ucb_cont)
## Admit
## Dept Admitted Rejected
## A 0.13278833 0.07335395
## B 0.08174989 0.04750331
## C 0.07114450 0.13168361
## D 0.05943438 0.11555457
## E 0.03247901 0.09655325
## F 0.01016350 0.14759169
sum(UCBAdmissions)
## [1] 4526
flat_ucb <- ftable(Gender ~ Admit + Dept, data = UCBAdmissions)
flat_ucb
## Gender Male Female
## Admit Dept
## Admitted A 512 89
## B 353 17
## C 120 202
## D 138 131
## E 53 94
## F 22 24
## Rejected A 313 19
## B 207 8
## C 205 391
## D 279 244
## E 138 299
## F 351 317
prop_ucb <- prop.table(flat_ucb)
prop_ucb
## Gender Male Female
## Admit Dept
## Admitted A 0.113124171 0.019664163
## B 0.077993814 0.003756076
## C 0.026513478 0.044631021
## D 0.030490499 0.028943880
## E 0.011710119 0.020768891
## F 0.004860804 0.005302696
## Rejected A 0.069155988 0.004197967
## B 0.045735749 0.001767565
## C 0.045293858 0.086389748
## D 0.061643836 0.053910738
## E 0.030490499 0.066062749
## F 0.077551922 0.070039770
sum(DanishWelfare$Freq)
## [1] 5144
DanishWelfare.tab <- xtabs(Freq ~., data = DanishWelfare)
str(DanishWelfare.tab)
## 'xtabs' num [1:3, 1:4, 1:3, 1:5] 1 3 2 8 1 3 2 5 2 42 ...
## - attr(*, "dimnames")=List of 4
## ..$ Alcohol: chr [1:3] "<1" "1-2" ">2"
## ..$ Income : chr [1:4] "0-50" "50-100" "100-150" ">150"
## ..$ Status : chr [1:3] "Widow" "Married" "Unmarried"
## ..$ Urban : chr [1:5] "Copenhagen" "SubCopenhagen" "LargeCity" "City" ...
## - attr(*, "call")= language xtabs(formula = Freq ~ ., data = DanishWelfare)
ftable(xtabs(Freq ~., data = DanishWelfare))
## Urban Copenhagen SubCopenhagen LargeCity City Country
## Alcohol Income Status
## <1 0-50 Widow 1 4 1 8 6
## Married 14 8 41 100 175
## Unmarried 6 1 2 6 9
## 50-100 Widow 8 2 7 14 5
## Married 42 51 62 234 255
## Unmarried 7 5 9 20 27
## 100-150 Widow 2 3 1 5 2
## Married 21 30 23 87 77
## Unmarried 3 2 1 12 4
## >150 Widow 42 29 17 95 46
## Married 24 30 50 167 232
## Unmarried 33 24 15 64 68
## 1-2 0-50 Widow 3 0 1 4 2
## Married 15 7 15 25 48
## Unmarried 2 3 9 9 7
## 50-100 Widow 1 1 3 8 4
## Married 39 59 68 172 143
## Unmarried 12 3 11 20 23
## 100-150 Widow 5 4 1 9 4
## Married 32 68 43 128 86
## Unmarried 6 10 5 21 15
## >150 Widow 26 34 14 48 24
## Married 43 76 70 198 136
## Unmarried 36 23 48 89 64
## >2 0-50 Widow 2 0 2 1 0
## Married 1 2 2 7 7
## Unmarried 3 0 1 5 1
## 50-100 Widow 3 0 2 1 3
## Married 14 21 14 38 35
## Unmarried 2 0 3 12 13
## 100-150 Widow 2 1 1 1 0
## Married 20 31 10 36 21
## Unmarried 0 2 3 9 7
## >150 Widow 21 13 5 20 8
## Married 23 47 21 53 36
## Unmarried 38 20 13 39 26
data("UKSoccer", package = "vcd")
ftable(UKSoccer)
## Away 0 1 2 3 4
## Home
## 0 27 29 10 8 2
## 1 59 53 14 12 4
## 2 28 32 14 12 4
## 3 19 14 7 4 1
## 4 7 8 10 2 0
sum(UKSoccer)
## [1] 380
prop.table(UKSoccer,1)
## Away
## Home 0 1 2 3 4
## 0 0.35526316 0.38157895 0.13157895 0.10526316 0.02631579
## 1 0.41549296 0.37323944 0.09859155 0.08450704 0.02816901
## 2 0.31111111 0.35555556 0.15555556 0.13333333 0.04444444
## 3 0.42222222 0.31111111 0.15555556 0.08888889 0.02222222
## 4 0.25925926 0.29629630 0.37037037 0.07407407 0.00000000
prop.table(UKSoccer,2)
## Away
## Home 0 1 2 3 4
## 0 0.19285714 0.21323529 0.18181818 0.21052632 0.18181818
## 1 0.42142857 0.38970588 0.25454545 0.31578947 0.36363636
## 2 0.20000000 0.23529412 0.25454545 0.31578947 0.36363636
## 3 0.13571429 0.10294118 0.12727273 0.10526316 0.09090909
## 4 0.05000000 0.05882353 0.18181818 0.05263158 0.00000000
prop.table(margin.table(UKSoccer,1))
## Home
## 0 1 2 3 4
## 0.20000000 0.37368421 0.23684211 0.11842105 0.07105263
prop.table(margin.table(UKSoccer,2))
## Away
## 0 1 2 3 4
## 0.36842105 0.35789474 0.14473684 0.10000000 0.02894737
library(vcd)
library(vcdExtra)
ds <- datasets(package = c("vcd", "vcdExtra"))
str(ds)
## 'data.frame': 76 obs. of 5 variables:
## $ Package: chr "vcd" "vcd" "vcd" "vcd" ...
## $ Item : chr "Arthritis" "Baseball" "BrokenMarriage" "Bundesliga" ...
## $ class : chr "data.frame" "data.frame" "data.frame" "data.frame" ...
## $ dim : chr "84x5" "322x25" "20x4" "14018x7" ...
## $ Title : chr "Arthritis Treatment Data" "Baseball Data" "Broken Marriage Data" "Ergebnisse der Fussball-Bundesliga" ...
head(ds)
## Package Item class dim
## 1 vcd Arthritis data.frame 84x5
## 2 vcd Baseball data.frame 322x25
## 3 vcd BrokenMarriage data.frame 20x4
## 4 vcd Bundesliga data.frame 14018x7
## 5 vcd Bundestag2005 table 16x5
## 6 vcd Butterfly table 24
## Title
## 1 Arthritis Treatment Data
## 2 Baseball Data
## 3 Broken Marriage Data
## 4 Ergebnisse der Fussball-Bundesliga
## 5 Votes in German Bundestag Election 2005
## 6 Butterfly Species in Malaya
ds
## Package Item class dim
## 1 vcd Arthritis data.frame 84x5
## 2 vcd Baseball data.frame 322x25
## 3 vcd BrokenMarriage data.frame 20x4
## 4 vcd Bundesliga data.frame 14018x7
## 5 vcd Bundestag2005 table 16x5
## 6 vcd Butterfly table 24
## 7 vcd CoalMiners table 2x2x9
## 8 vcd DanishWelfare data.frame 180x5
## 9 vcd Employment table 2x6x2
## 10 vcd Federalist table 7
## 11 vcd Hitters data.frame 154x4
## 12 vcd HorseKicks table 5
## 13 vcd Hospital table 3x3
## 14 vcd JobSatisfaction data.frame 8x4
## 15 vcd JointSports data.frame 40x5
## 16 vcd Lifeboats data.frame 18x8
## 17 vcd MSPatients array 4x4x2
## 18 vcd NonResponse data.frame 12x4
## 19 vcd OvaryCancer data.frame 16x5
## 20 vcd PreSex table 2x2x2x2
## 21 vcd Punishment data.frame 36x5
## 22 vcd RepVict table 8x8
## 23 vcd Rochdale table 2x2x2x2x2x2x2x2
## 24 vcd Saxony table 13
## 25 vcd SexualFun table 4x4
## 26 vcd SpaceShuttle data.frame 24x6
## 27 vcd Suicide data.frame 306x6
## 28 vcd Trucks data.frame 24x5
## 29 vcd UKSoccer table 5x5
## 30 vcd VisualAcuity data.frame 32x4
## 31 vcd VonBort data.frame 280x4
## 32 vcd WeldonDice table 11
## 33 vcd WomenQueue table 11
## 34 vcdExtra Abortion table 2x2x2
## 35 vcdExtra Accident data.frame 80x5
## 36 vcdExtra AirCrash data.frame 439x5
## 37 vcdExtra Alligator data.frame 80x5
## 38 vcdExtra Bartlett table 2x2x2
## 39 vcdExtra Burt data.frame 36x5
## 40 vcdExtra Caesar table 3x2x2x2
## 41 vcdExtra Cancer table 2x2x2
## 42 vcdExtra Cormorants data.frame 343x8
## 43 vcdExtra CyclingDeaths data.frame 208x2
## 44 vcdExtra DaytonSurvey data.frame 32x6
## 45 vcdExtra Depends table 15
## 46 vcdExtra Detergent table 2x2x2x3
## 47 vcdExtra Donner data.frame 90x5
## 48 vcdExtra Draft1970 data.frame 366x3
## 49 vcdExtra Draft1970table table 12x3
## 50 vcdExtra Dyke table 2x2x2x2x2
## 51 vcdExtra Fungicide array 2x2x2x2
## 52 vcdExtra GSS data.frame 6x3
## 53 vcdExtra Geissler data.frame 90x4
## 54 vcdExtra Gilby table 6x4
## 55 vcdExtra Glass data.frame 25x3
## 56 vcdExtra HairEyePlace array 4x5x2
## 57 vcdExtra Hauser79 data.frame 25x3
## 58 vcdExtra Heart table 2x2x3
## 59 vcdExtra Heckman table 2x2x2x2x2
## 60 vcdExtra HospVisits table 3x3
## 61 vcdExtra Hoyt table 4x3x7x2
## 62 vcdExtra ICU data.frame 200x22
## 63 vcdExtra JobSat table 4x4
## 64 vcdExtra Mammograms matrix 4x4
## 65 vcdExtra Mental data.frame 24x3
## 66 vcdExtra Mice data.frame 30x4
## 67 vcdExtra Mobility table 5x5
## 68 vcdExtra PhdPubs data.frame 915x6
## 69 vcdExtra ShakeWords data.frame 100x2
## 70 vcdExtra TV array 5x11x3
## 71 vcdExtra Titanicp data.frame 1309x6
## 72 vcdExtra Toxaemia data.frame 60x5
## 73 vcdExtra Vietnam data.frame 40x4
## 74 vcdExtra Vote1980 data.frame 28x4
## 75 vcdExtra WorkerSat data.frame 8x4
## 76 vcdExtra Yamaguchi87 data.frame 75x4
## Title
## 1 Arthritis Treatment Data
## 2 Baseball Data
## 3 Broken Marriage Data
## 4 Ergebnisse der Fussball-Bundesliga
## 5 Votes in German Bundestag Election 2005
## 6 Butterfly Species in Malaya
## 7 Breathlessness and Wheeze in Coal Miners
## 8 Danish Welfare Study Data
## 9 Employment Status
## 10 'May' in Federalist Papers
## 11 Hitters Data
## 12 Death by Horse Kicks
## 13 Hospital data
## 14 Job Satisfaction Data
## 15 Opinions About Joint Sports
## 16 Lifeboats on the Titanic
## 17 Diagnosis of Multiple Sclerosis
## 18 Non-Response Survey Data
## 19 Ovary Cancer Data
## 20 Pre-marital Sex and Divorce
## 21 Corporal Punishment Data
## 22 Repeat Victimization Data
## 23 Rochdale Data
## 24 Families in Saxony
## 25 Sex is Fun
## 26 Space Shuttle O-ring Failures
## 27 Suicide Rates in Germany
## 28 Truck Accidents Data
## 29 UK Soccer Scores
## 30 Visual Acuity in Left and Right Eyes
## 31 Von Bortkiewicz Horse Kicks Data
## 32 Weldon's Dice Data
## 33 Women in Queues
## 34 Abortion Opinion Data
## 35 Traffic Accident Victims in France in 1958
## 36 Air Crash Data
## 37 Alligator Food Choice
## 38 Bartlett data on plum root cuttings
## 39 Burt (1950) Data on Hair, Eyes, Head and Stature
## 40 Risk Factors for Infection in Caesarian Births
## 41 Survival of Breast Cancer Patients
## 42 Advertising Behavior by Males Cormorants
## 43 London Cycling Deaths
## 44 Dayton Student Survey on Substance Use
## 45 Dependencies of R Packages
## 46 Detergent preference data
## 47 Survival in the Donner Party
## 48 USA 1970 Draft Lottery Data
## 49 USA 1970 Draft Lottery Table
## 50 Sources of Knowledge of Cancer
## 51 Carcinogenic Effects of a Fungicide
## 52 General Social Survey- Sex and Party affiliation
## 53 Geissler's Data on the Human Sex Ratio
## 54 Clothing and Intelligence Rating of Children
## 55 British Social Mobility from Glass(1954)
## 56 Hair Color and Eye Color in Caithness and Aberdeen
## 57 Hauser (1979) Data on Social Mobility
## 58 Sex, Occupation and Heart Disease
## 59 Labour Force Participation of Married Women 1967-1971
## 60 Hospital Visits Data
## 61 Minnesota High School Graduates
## 62 ICU data set
## 63 Cross-classification of job satisfaction by income
## 64 Mammogram Ratings
## 65 Mental impariment and parents SES
## 66 Mice Depletion Data
## 67 Social Mobility data
## 68 Publications of PhD Candidates
## 69 Shakespeare's Word Type Frequencies
## 70 TV Viewing Data
## 71 Passengers on the Titanic
## 72 Toxaemia Symptoms in Pregnancy
## 73 Student Opinion about the Vietnam War
## 74 Race and Politics in the 1980 Presidential Vote
## 75 Worker Satisfaction Data
## 76 Occupational Mobility in Three Countries
structable(Damage ~ Fail + nFailures, data = SpaceShuttle)
## Damage 0 2 4 11
## Fail nFailures
## no 0 15 0 1 0
## 1 0 0 0 0
## 2 0 0 0 0
## yes 0 0 0 0 0
## 1 0 1 4 0
## 2 0 0 1 1
ftable(Damage ~ Fail + nFailures, data = SpaceShuttle)
## Damage 0 2 4 11
## Fail nFailures
## no 0 15 0 1 0
## 1 0 0 0 0
## 2 0 0 0 0
## yes 0 0 0 0 0
## 1 0 1 4 0
## 2 0 0 1 1