faraway wbca problem on d and e help needed Breast Cancer

#1
I have homework problem on page 378 about breast cancer the question asks
Suppose the a cancer is classified as benign if p  0.5 and malignant if p < 0.5. Compute the number of
errors of both types that will be made if this method is applied to the current data with the reduced
model.
(e) Suppose we change the cutoff to 0.9 so that p < 0.9 is classed as malignant and p  0.9 as benign.
Compute the number of errors in this case. Discuss the issues in determining the cutoff.

how do you do it in R
 
#2
This is very easy to do just make sure to input your model name into it. *change
D<-with(
*Themodelnamrit#1inR(,1.249852-0.046024*BNucl-0.020809*USize-0.032588*Thick-
0.019955*NNucl-0.019872*Chrom-0.014199*UShap-0.010331*Epith-0.007912*Adhes)
(this is the updated model)$p <- with(*this is the updated model,exp(Predx1) / (1+exp(Predx1)))
*this is the updated model$PMClass <- withthis is the updated model,abs(p-Class))
for(i in 1:length(this is the updated model$PMClass)){
if(*this is the updated model$PMClass<0.5)
{
*this is the updated model$error <- 0
}else

{
*this is the updated model$error <- 1
}
}


*this is the updated model$ClassMp <- with(this is the updated model,Class-p)
*this is the updated model$er1 <- rep(0,length(*this is the updated model$ClassMp))
for(i in 1:length(*this is the updated model$ClassMp)){
if(*this is the updated model$ClassMp<-0.9 && *this is the updated model$ClassMp>0.1)
{
*Updatemode$er1 <- 1
}else
{
this is the updated model$er1 <- 0
}
}
sum(*this is the updated model$ClassMp)
> sum(*this is the updated model$ClassMp)
[1] 443