So I have this table about virus and it's infections/death/etc. Here is my code and original table:
data <- clean_names(read.csv("Book1.csv"))
TableN <- data %>% mutate(PeopleInfected = Suseptible* 1/8) %>% mutate(PeopleDeadFromInfection = PeopleInfected * 1/8) %>%
mutate(ImmuneFromSmallpox = PeopleInfected - PeopleDeadFromInfection)
> head(TableN)
age Susceptible PeopleInfected PeopleDeadFromInfection ImmuneFromSmallpox
1 0 1300 162.500 20.31250 142.18750
2 1 1000 125.000 15.62500 109.37500
3 2 855 106.875 13.35938 93.51562
4 3 798 99.750 12.46875 87.28125
5 4 760 95.000 11.87500 83.12500
6 5 732 91.500 11.43750 80.06250
There is a 1/8 chance of getting the virus, and an additional 1/8 chance of dying from it. Those who survive are forever immune to the virus. As a result, I have to subtract the 'ImmuneFromSmallpox' column from 'suspectible' to account for those who survived and are forever immune from the virus.
Here is what the table should look like:
> head(TableN)
age Susceptible PeopleInfected PeopleDeadFromInfection ImmuneFromSmallpox
1 0 1300 162.500 20.31250 142.18750
2 1 858.8125 107.226 13.40335 93.82265
3 2 761.17735 95.1471 11.89339 83.25371
To be more clear, I want the first row to stay the same, but I want the other rows to change. What function do you recommend I use?