You can compare test data using table() to get a confusion matrix.
1. Create your decision tree.
decision_tree = rpart(predicting value~.,train data)
2. Use the tree to predict for test data.
predicted_table = predict(decision_tree, test data, type = "class")
3. Now use table(predicting variable,predicted model).
table(predicting variable, predicted_table)
The table gives a confusion matrix like below. It displays the number of records with a true positive, false positive. true negative, false negative count. The row and column can be Yes/No or True/False.

Yes/True 
No/False 
Yes/True 


No/False 


4. Calculate accuracy as count in [Yes,Yes] + [No,No] / [count of all cells]).