R formulas: difference between ~A+B+A:B, ~0+paste0(A,B), ~paste0(A,B)? What is the mathematical meaning of those formulas, please? I am trying to get my head around R formulas for statistical tests. I have read this page (http://cran.r-project.org/doc/manuals/R-intro.html#Formulae-for-statistical-models) which is really helpful. But I still am not entirely clear really.
I have these conditions:
A B 
x 1 
y 1
z 1
x 2
y 2
z 2
x 3
y 3
z 3 

And I would like to compare x and z at  B=1 for instance in the end.
I first went for ~A+B+A:B but I read that ~0+paste0(A,B) or ~paste0(A,B) would do the same. I am confused. Would it be possible to explain what is the meaning of those formulas please? What are the mathematical formulas that are really taken into account in the background?
Please be kind I am not a statistician !
 A: Assuming that B is also categorical ...
With paste, all the combinations of (x,y,z) and (1,2,3) are explicitly put into the formula. The other method will use a "reference" category (e.g. X and 1) and all other measurements will be relative to that.
For instance, if you are doing linear regression:
y ~ 0 + paste0(A,B)
This gives the formula 
$ y \sim \beta_0I_{A=x,B=1} + \beta_1I_{A=x,B=2} + \beta_2I_{A=x,B=3} + \beta_3I_{A=y,B=1} + \beta_4I_{A=y,B=2} + \beta_5I_{A=y,B=3} + \beta_6I_{A=z,B=1} + \beta_7I_{A=z,B=2} + \beta_8I_{A=z,B=3}$
($I_{A=y}$ is an indicator function that is 1 if A=y and 0 otherwise)
In this case, if A=x and B=1, then $y = \beta_0$. If A=x and B=2, then $y = \beta_1$. If A=z and B=3, then $y = \beta_8$.
y ~ A + B + A:B
This gives the formula
$ y \sim \beta_0 + \beta_1I_{A=y} + \beta_2I_{A=z} + \beta_3I_{B=2} + \beta_4I_{B=3} + \beta_5I_{A=y,B=2} + \beta_6I_{A=y,B=3} + \beta_7I_{A=z,B=2} + \beta_8I_{A=z,B=3}$
In this case if A=x and B=1, then $y = \beta_0$. If A=x and B=2, then $y = \beta_0 + \beta_3$. If A=z and B=3, then $y = \beta_0 + \beta_2 + \beta_4 + \beta_8$.
