How does R calculate the probabilities in Naive Bayes

r
naive_bayes

#1

hello,

In Naive Bayes we calculate the predicted probabilities by:

I am applying Naive Bayes on the below data:

While trying to interpret the below output:

I am not being able to match the predicted probabilities with the formula for NaiveBayes.The test dataset looks like:

So for the first record,we need to find:
Max(P(C = y|VP = n,IP = n),P(C = n|VP = n,IP = n)).
Now when I try to find:
P(C = y|VP = n,IP = n) = P(C = y|VP = n)P(C = y|IP = n)=
P(C = y))
(P(VP = n|C = y))*(P(VP = n|C = y))
Then:
1.(P(C = y)) = 0.1449145, from the A priori prob.
2.(P(VP = n|C = y)) = {P(C = y|VP = n)*P(VP = n)/P(C = y)} ={0.8343685 * 0.72/0.1449} = 4.14
Now this is surely wrong,but I am not being able to figure out why.
Can someone please help me with this.
The total records in the dataset is 3333.Other required figures are in the image.