I have a data set having 150 observations and 45 categories. How to find out the conditional probability of a category AB given AC is there for each id.1, 2,3, etc., are unique ids.

My dataset looks like

1.AB AD AC FG AB DC GM AC

2.AB AC DG GM

3.AB DG GM AC

I am trying to find out in R and excel but it did not help. Could you please help.

PS: the categories are not necessarily consecutive. I am considering each category as unique for every id.