The calculations in Box 6.1 do not rely on SAS- or R-specific code. However, I will reproduce the calculations below to illustrate how R can be used as a calculator.

> N0 <- 1000             # Initial population
> N12 <- 700             # Final population
> d <- N0-N12            # Interval absolute mortality (i.e., number of deaths)
> d
[1] 300
> A12 <- d/N0            # Interval (12 month) mortality rate
> 100*A12
[1] 30
> Z12 <- -log(1-A12)     # Instantaneous mortality rate
> Z12
[1] 0.3566749
> Z1 <- Z12/12           # Monthly instantaneous mortality rate
> Z4 <- 4*Z1             # Four-month Z estimate
> Z4
[1] 0.1188916
> Z8 <- 8*Z1             # Eight-month Z estimate
> Z8
[1] 0.2377833
> A4 <- 1-exp(-Z4)       # Interval (4-month) mortality rate
> 100*A4
[1] 11.2096
> A8 <- 1-exp(-Z8)       # Interval (8-month) mortality rate
> 100*A8
[1] 21.16265

Note the use of round() to round the results to a specified number of decimal places. This function requires two arguments — the value(s) to be rounded as the first argument and the number of decimal places as the second argument.

> d4 <- N0*A4            # Deaths in first four-months
> round(d4,0)
[1] 112
> N4 <- N0-d4            # Estimated survivors after 4-months
> round(N4,0)
[1] 888
> d8 <- N0*A8            # Deaths in first eight-months
> round(d8,0)
[1] 212
> N8 <- N0-d8            # Estimated survivors after 4-months
> round(N8,0)
[1] 788
> d8.4 <- d8-d4          # Deaths in second four-months
> round(d8.4,0)
[1] 100
> d12.8 <- d-d8          # Deaths in third four-months
> round(d12.8,0)
[1] 88
> d4+d8.4+d12.8         # Total deaths in the three four-month periods
[1] 300
> (d4+d8.4+d12.8) == d  # Does this equal the first deaths calculation?
[1] TRUE