Adjusting control mortality in LC50/LD50 determination using R

Problem:
There are R codes for calculating LC50 or LD50 using 4 to 6 data points. However, none uses control mortality correction (e.g. Abbott correction). There is an ecotoxicology package which does this, but it seems hugely complex to use.

Solution:
In the code below, we put the last line as the control mortality (dose=0), which is used to calculate the correction
Adjusted mortality = (mortality – control.mortality)/ (1 – mortality)

Then the last line of data was dropped by using subset.

Data structure:

dose 	dead 	alive
1000.00   15     0
500.00   13     2
250.00   12     5
125.00    8     8
62.50    6     9
31.25    3    12
0.00    2    13

New data after mortality correction:

the adjusted data would have this
     dose      dead     alive
1 1000.00 15.000000  0.000000
2  500.00 12.692308  2.307692
3  250.00 11.230769  5.769231
4  125.00  6.769231  9.230769
5   62.50  4.615385 10.384615
6   31.25  1.153846 13.846154

Code:

data = read.csv("LD50-2.csv")
c=nrow(data)  
N=data$dead+data$alive

mort=data$dead/N
ad.mort=(mort-mort[c])/(1-mort[c])
data$dead=N*ad.mort
data$alive=N-data$dead

data=subset(data, dose!=0)

y = cbind(data$alive,data$dead)
model.results = glm(y~log(data$dose+1),binomial)
summary(model.results)
library(MASS)

ld50=exp(dose.p(model.results,p=0.5))
ld50

The calculated LD50 here is 141.7363 +- 0.1774705 (SE).
The unit will be the same as the dose in the first file. i.e. if it is mg, then it is 141.7 mg here.