I am trying to print out this table with xtable(), which is reproduced below:
X B.1 B.2 B.3
1 (Intercept) -1.669 (0.093) -1.701 (0.094) -1.774 (0.121)
2 SEXFemale -0.46 (0.023) -0.386 (0.04) -0.274 (0.17)
3 SEXFemale:BLACK 0.132 (0.163)
4 SEXFemale:ASIAN -0.063 (0.089)
5 SEXFemale:HISPANIC -0.128 (0.074)
But I would like to override the way the first column is printed. Is it possible to include latex commands in xtable() or some other function to do this? Specifically, I would like the first column to be :
X
Male: Female
Female X Black
X Asian
X Hispanic
i.e. I would like to write a \phantom{} switch into the column so that the spacing comes out right.
You can use a regular expression to insert the
\phantom{}into your table before callingxtable():Recreate your data:
The regex:
The resulting text:
And the final output: