anthro[lab[demo]]
# id bmi tc demo.var
# 1: 1 NA 0.7635935 1.262954285
# 2: 2 NA -0.7990092 -0.326233361
# 3: 3 NA -1.1476570 1.329799263
# 4: 4 -0.8919211 -0.2894616 1.272429321
# 5: 5 0.4356833 -0.2992151 0.414641434
# 6: 6 -1.2375384 -0.4115108 -1.539950042
# 7: 7 -0.2242679 0.2522234 -0.928567035
# 8: 8 0.3773956 NA -0.294720447
# 9: 9 0.1333364 NA -0.005767173
# 10: 10 NA NA 2.404653389
The inner table is always the one the outer join is performed on, so this nesting makes sure that the table with the super set of the index values is always the inner table.