I have data like below data;
PersonId (Uniq) | Disease | Survival |
---|---|---|
1 | A | 1 |
2 | B | 0 |
3 | A | 0 |
4 | C | 1 |
5 | B | 0 |
6 | D | 1 |
7 | C | 0 |
8 | A | 1 |
9 | D | 0 |
10 | D | 1 |
I want to get a ratio from this data table. Calculation of this ratio;
Survival rate by disease: Number of survivors (1) by disease / Total number of people by disease
As a result of this calculation, I want to create a table as follows;
Disease | Total number of people | Number of Survivors | Oran |
---|---|---|---|
A | 3 | 2 | 0.66 |
B | 2 | 0 | 0 |
C | 2 | 1 | 0.5 |
D | 3 | 2 | 0.66 |
I don't know where to start, what kind of code should I write to get a table like this.