I agree that it doesn't matter a damn what coding you use, but sometimes it
is useful to look at an integer version of the contrast matrix just to see
what's going on. This is useful for teaching. Here is the way I have done
it in the past using a function from the MASS library. Not automatic, but
this is not the kind of thing you need to do every day... I have trimmed
the output a bit to make it more readable, too.
library(MASS)
X <- poly(1:8, 5)
dim(X)
fractions(X/rep(X[1, ], each=nrow(X))) # gets rid of surds.
1 2 3 4 5
[1,] 1 1 1 1 1
[2,] 5/7 1/7 -5/7 -13/7 -23/7
[3,] 3/7 -3/7 -1 -3/7 17/7
[4,] 1/7 -5/7 -3/7 9/7 15/7
[5,] -1/7 -5/7 3/7 9/7 -15/7
[6,] -3/7 -3/7 1 -3/7 -17/7
[7,] -5/7 1/7 5/7 -13/7 23/7
[8,] -1 1 -1 1 -1
fractions(X/rep(X[1, ], each = nrow(X)))*7
1 2 3 4 5
[1,] 7 7 7 7 7
[2,] 5 1 -5 -13 -23
[3,] 3 -3 -7 -3 17
[4,] 1 -5 -3 9 15
[5,] -1 -5 3 9 -15
[6,] -3 -3 7 -3 -17
[7,] -5 1 5 -13 23
[8,] -7 7 -7 7 -7
In fact I find fractions() useful for a lot of things, somewhat to my
surprise.