Error in as.double(y) :
cannot coerce type 'S4' to vector of type 'double'
CART Trees prediction always doesn't only one column. you need to select the right column when you need to predict.
In the following case, i choose the 3rd column, CTree.pred1[,2]
Step1: CTree.ROCpred = prediction(CTree.pred1[,2],test$over50k)
Step2: plot(CTree.ROCpred)
you will meet the above error message.
change to the following one,
plot ( performance ( CTree.ROCpred, measure = "tpr", x.measure = "fpr"), colorize = TRUE)