I am comparing a bunch of baseline and end-of-study differences across groups. For examples, I may have the following data set:
> baseline.comp
cluster 1970_pred 2008_pred ratio diff
9 Many Transitions, Middle Income 0.1156 0.0248 4.6613 0.0908
10 Many Transitions, Low Income 0.1779 0.0389 4.5733 0.1390
4 Dictatorships, High Income 0.1403 0.0307 4.5700 0.1096
7 One Transition, Middle Income 0.0801 0.0219 3.6575 0.0582
1 Democracies, High Income 0.0396 0.0116 3.4138 0.0280
5 Dictatorships, Middle Income 0.1252 0.0399 3.1378 0.0853
2 Democracies, Middle Income 0.0811 0.0291 2.7869 0.0520
8 One Transition, Low Income 0.1912 0.0775 2.4671 0.1137
3 Democracies, Low Income 0.1612 0.0698 2.3095 0.0914
6 Dictatorships, Low Income 0.1854 0.0821 2.2582 0.1033
In this example, I would like to compare the column pred_1970 with itself so that I could have a table telling me about the differences in baseline conditions across these clusters. It would a 10 by 10 table but only the bellow diagonal cells would have actuall numbers, reflecting the differences in the initial conditions for these groups. I was wondering if R already has some implemented functionally to do that.
Thank you,
Antonio Pedro
outeris what you are looking for.To display only the lower (or upper) triangle use
trilortriuin theMatrixpackage