I have a data source that looks like the following:
pirate_size pirate_age victim_size
large adult large
large adult large
large immature small
small immature small
small immature small
I want to create a contingency table in R that contains the values divided by the total number of rows (in this case, the total number is 5). Using the following code I get a normal contingency table:
table1 <-(data$pirate_age,data$pirate_size)
But I want the output to be:
Adult Immature
Large 2/5 1/5
Small 0 2/5