I have a large dataset that can be represented something like this:
plot 1 2 3 3 3 4 4 5 5 5 5 6 7 fate SMSSMSSSMSSMM
where the plot is the place, and fate is "survival" or "mortality" (the plant lives or dies). The plot number of the plant corresponds to the fate underneath. Thus, in plot 5 there are 4 plants. 3 of them survive, 1 dies.
I want to figure out a way to make R calculate the proportion of people who survive in each plot for all of these. It is very difficult.
Example: Section 5 will return a survival value of 3/4 or 75%. Section 3 will return a survival value of 2/3 or 66%.
Any help would be greatly appreciated. thank you
Data
structure(list(plot = c(1, 2, 3, 3, 3, 4, 4, 5, 5, 5, 5, 6, 7 ), fate = structure(c(2L, 1L, 2L, 2L, 1L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 1L), .Label = c("M", "S"), class = "factor")), .Names = c("plot", "fate"), row.names = c(NA, -13L), class = "data.frame")