This document contains the descriptive statistics (number of non-missing observations, mean, standard deviation, minimum value, maximum value and internal reliablity, where relevant) of the variables used in the current coordinated analyses. We provide the code used to generate this table, which calls upon our analysis summary objects (also provided).
Variable | N Valid | Mean | SD | Min | Max | \(\alpha\) | \(\omega\) |
---|---|---|---|---|---|---|---|
BASEII | |||||||
age | 1437 | 60.16 | 15.77 | 21.00 | 84.00 | ||
gender | 1437 | 0.50 | 0.50 | 0.00 | 1.00 | ||
edu | 1437 | 14.34 | 2.85 | 7.00 | 18.00 | ||
bmi | 1437 | 26.26 | 4.28 | 15.57 | 47.68 | ||
has_cc | 1437 | 0.57 | 0.50 | 0.00 | 1.00 | ||
neur | 1437 | 3.78 | 1.29 | 1.00 | 7.00 | 0.66 | 0.05 |
con | 1437 | 5.58 | 0.99 | 1.33 | 7.00 | 0.58 | 0.03 |
extra | 1437 | 4.78 | 1.17 | 1.33 | 7.00 | 0.68 | 0.04 |
agree | 1437 | 5.22 | 1.00 | 1.67 | 7.00 | 0.50 | 0.01 |
open | 1437 | 5.27 | 1.00 | 1.75 | 7.00 | 0.65 | 0.55 |
diabetes | 1437 | 0.07 | 0.25 | 0.00 | 1.00 | ||
highblood | 1437 | 0.36 | 0.48 | 0.00 | 1.00 | ||
heart | 1437 | 0.10 | 0.30 | 0.00 | 1.00 | ||
diabetes_diag | 1337 | 0.04 | 0.21 | 0.00 | 1.00 | ||
highblood_diag | 914 | 0.15 | 0.36 | 0.00 | 1.00 | ||
heart_diag | 1291 | 0.06 | 0.24 | 0.00 | 1.00 | ||
EAS | |||||||
age | 734 | 78.83 | 5.31 | 69.00 | 99.00 | ||
gender | 734 | 0.61 | 0.49 | 0.00 | 1.00 | ||
edu | 734 | 14.37 | 3.36 | 3.00 | 24.00 | ||
bmi | 734 | 28.27 | 5.09 | 15.10 | 50.30 | ||
has_cc | 734 | 0.85 | 0.36 | 0.00 | 1.00 | ||
neur | 734 | 2.15 | 0.65 | 1.00 | 4.20 | 0.75 | 0.51 |
con | 734 | 3.80 | 0.65 | 1.00 | 5.00 | 0.79 | 0.60 |
extra | 734 | 3.34 | 0.64 | 1.20 | 4.90 | 0.76 | 0.56 |
agree | 734 | 4.04 | 0.53 | 2.00 | 5.00 | 0.70 | 0.48 |
open | 734 | 3.66 | 0.64 | 1.80 | 5.00 | 0.72 | 0.52 |
diabetes | 734 | 0.19 | 0.39 | 0.00 | 1.00 | ||
highblood | 734 | 0.66 | 0.47 | 0.00 | 1.00 | ||
heart | 734 | 0.37 | 0.48 | 0.00 | 1.00 | ||
diabetes_diag | 417 | 0.03 | 0.17 | 0.00 | 1.00 | ||
highblood_diag | 162 | 0.22 | 0.41 | 0.00 | 1.00 | ||
heart_diag | 325 | 0.15 | 0.36 | 0.00 | 1.00 | ||
ELSA | |||||||
age | 6263 | 66.39 | 8.55 | 29.00 | 99.00 | ||
gender | 6263 | 0.56 | 0.50 | 0.00 | 1.00 | ||
edu | 6263 | 4.19 | 2.23 | 1.00 | 7.00 | ||
bmi | 6263 | 28.15 | 5.03 | 15.10 | 54.60 | ||
has_cc | 6263 | 0.55 | 0.50 | 0.00 | 1.00 | ||
neur | 6263 | 2.09 | 0.59 | 1.00 | 4.00 | 0.68 | 0.61 |
con | 6263 | 3.31 | 0.48 | 1.40 | 4.00 | 0.67 | 0.58 |
extra | 6263 | 3.16 | 0.55 | 1.00 | 4.00 | 0.76 | 0.62 |
agree | 6263 | 3.51 | 0.47 | 1.00 | 4.00 | 0.80 | 0.73 |
open | 6263 | 2.88 | 0.55 | 1.00 | 4.00 | 0.79 | 0.67 |
diabetes | 6263 | 0.08 | 0.27 | 0.00 | 1.00 | ||
highblood | 6263 | 0.39 | 0.49 | 0.00 | 1.00 | ||
heart | 5967 | 0.18 | 0.39 | 0.00 | 1.00 | ||
diabetes_diag | 5199 | 0.04 | 0.19 | 0.00 | 1.00 | ||
highblood_diag | 3454 | 0.11 | 0.31 | 0.00 | 1.00 | ||
heart_diag | 4411 | 0.08 | 0.28 | 0.00 | 1.00 | ||
HRS | |||||||
age | 18925 | 66.28 | 11.14 | 25.00 | 105.00 | ||
gender | 18925 | 0.58 | 0.49 | 0.00 | 1.00 | ||
edu | 18925 | 12.69 | 3.10 | 0.00 | 17.00 | ||
bmi | 18925 | 28.47 | 6.10 | 10.50 | 70.90 | ||
has_cc | 18925 | 0.63 | 0.48 | 0.00 | 1.00 | ||
neur | 18925 | 2.07 | 0.63 | 1.00 | 4.00 | 0.71 | 0.70 |
con | 18925 | 3.35 | 0.49 | 1.00 | 4.00 | 0.66 | 0.63 |
extra | 18925 | 3.19 | 0.56 | 1.00 | 4.00 | 0.75 | 0.66 |
agree | 18925 | 3.52 | 0.49 | 1.00 | 4.00 | 0.78 | 0.70 |
open | 18925 | 2.94 | 0.56 | 1.00 | 4.00 | 0.79 | 0.68 |
diabetes | 18911 | 0.20 | 0.40 | 0.00 | 1.00 | ||
highblood | 18907 | 0.55 | 0.50 | 0.00 | 1.00 | ||
heart | 18907 | 0.22 | 0.41 | 0.00 | 1.00 | ||
diabetes_diag | 15169 | 0.08 | 0.27 | 0.00 | 1.00 | ||
highblood_diag | 8460 | 0.23 | 0.42 | 0.00 | 1.00 | ||
heart_diag | 14717 | 0.12 | 0.32 | 0.00 | 1.00 | ||
ILSE | |||||||
age | 478 | 62.51 | 0.96 | 60.00 | 64.00 | ||
gender | 478 | 0.52 | 0.50 | 0.00 | 1.00 | ||
edu | 478 | 2.43 | 1.02 | 1.00 | 4.00 | ||
bmi | 478 | 26.71 | 3.68 | 17.28 | 41.51 | ||
has_cc | 478 | 0.86 | 0.35 | 0.00 | 1.00 | ||
neur | 478 | 2.56 | 0.58 | 1.08 | 4.33 | 0.77 | 0.62 |
con | 478 | 3.94 | 0.43 | 2.45 | 4.92 | 0.73 | 0.50 |
extra | 478 | 3.35 | 0.47 | 1.67 | 4.67 | 0.70 | 0.49 |
agree | 478 | 3.70 | 0.39 | 2.58 | 4.75 | 0.62 | 0.51 |
open | 478 | 3.36 | 0.40 | 2.00 | 4.58 | 0.48 | 0.29 |
diabetes | 477 | 0.11 | 0.31 | 0.00 | 1.00 | ||
highblood | 475 | 0.42 | 0.49 | 0.00 | 1.00 | ||
heart | 478 | 0.41 | 0.49 | 0.00 | 1.00 | ||
diabetes_diag | 425 | 0.04 | 0.19 | 0.00 | 1.00 | ||
highblood_diag | 280 | 0.14 | 0.34 | 0.00 | 1.00 | ||
heart_diag | 281 | 0.32 | 0.47 | 0.00 | 1.00 | ||
LBC | |||||||
age | 959 | 69.50 | 0.84 | 67.61 | 71.30 | ||
gender | 959 | 0.51 | 0.50 | 0.00 | 1.00 | ||
edu | 959 | 10.77 | 1.12 | 8.00 | 14.00 | ||
bmi | 959 | 27.69 | 4.25 | 16.02 | 48.52 | ||
has_cc | 959 | 0.46 | 0.50 | 0.00 | 1.00 | ||
neur | 959 | 1.43 | 0.64 | 0.00 | 3.92 | 0.87 | 0.69 |
con | 959 | 2.89 | 0.50 | 0.92 | 4.00 | 0.86 | 0.68 |
extra | 959 | 2.25 | 0.49 | 0.50 | 3.58 | 0.79 | 0.56 |
agree | 959 | 2.79 | 0.44 | 1.42 | 3.92 | 0.74 | 0.57 |
open | 959 | 2.17 | 0.48 | 0.75 | 3.58 | 0.72 | 0.51 |
diabetes | 959 | 0.08 | 0.27 | 0.00 | 1.00 | ||
highblood | 959 | 0.40 | 0.49 | 0.00 | 1.00 | ||
heart | 959 | 0.24 | 0.43 | 0.00 | 1.00 | ||
LBLS | |||||||
age | 935 | 68.44 | 12.91 | 30.00 | 94.00 | ||
gender | 935 | 0.55 | 0.50 | 0.00 | 1.00 | ||
edu | 935 | 14.69 | 2.66 | 4.00 | 20.00 | ||
bmi | 935 | 0.45 | 0.61 | 0.06 | 9.42 | ||
has_cc | 935 | 0.32 | 0.47 | 0.00 | 1.00 | ||
neur | 935 | 1.64 | 0.45 | 0.46 | 3.40 | 0.92 | 0.84 |
con | 935 | 2.22 | 0.39 | 0.88 | 3.50 | 0.88 | 0.52 |
extra | 935 | 2.26 | 0.37 | 1.31 | 3.33 | 0.86 | 0.57 |
agree | 935 | 2.62 | 0.33 | 1.42 | 3.65 | 0.86 | 0.43 |
open | 935 | 2.53 | 0.38 | 1.27 | 3.60 | 0.90 | 0.61 |
diabetes | 933 | 0.10 | 0.30 | 0.00 | 1.00 | ||
highblood | 927 | 0.46 | 0.50 | 0.00 | 1.00 | ||
diabetes_diag | 845 | 0.58 | 0.49 | 0.00 | 1.00 | ||
highblood_diag | 505 | 0.51 | 0.50 | 0.00 | 1.00 | ||
MAP | |||||||
age | 604 | 79.68 | 7.14 | 56.14 | 96.93 | ||
gender | 604 | 0.76 | 0.43 | 0.00 | 1.00 | ||
edu | 604 | 14.94 | 2.91 | 4.00 | 28.00 | ||
bmi | 604 | 27.26 | 5.17 | 9.10 | 49.61 | ||
has_cc | 604 | 0.58 | 0.49 | 0.00 | 1.00 | ||
neur | 604 | 2.25 | 0.59 | 1.00 | 4.75 | 0.86 | 0.67 |
con | 604 | 4.79 | 0.49 | 2.50 | 6.00 | 0.80 | 0.27 |
extra | 604 | 3.66 | 0.51 | 1.83 | 5.00 | 0.68 | 0.57 |
diabetes | 604 | 0.14 | 0.35 | 0.00 | 1.00 | ||
highblood | 604 | 0.54 | 0.50 | 0.00 | 1.00 | ||
heart | 604 | 0.10 | 0.30 | 0.00 | 1.00 | ||
diabetes_diag | 519 | 0.10 | 0.30 | 0.00 | 1.00 | ||
highblood_diag | 278 | 0.30 | 0.46 | 0.00 | 1.00 | ||
heart_diag | 543 | 0.08 | 0.26 | 0.00 | 1.00 | ||
MAS | |||||||
age | 860 | 78.66 | 4.76 | 70.29 | 90.80 | ||
gender | 860 | 0.46 | 0.50 | 0.00 | 1.00 | ||
edu | 860 | 11.70 | 3.53 | 3.00 | 24.00 | ||
bmi | 860 | 27.12 | 4.46 | 15.79 | 44.44 | ||
has_cc | 860 | 0.72 | 0.45 | 0.00 | 1.00 | ||
neur | 860 | 1.67 | 0.79 | 0.00 | 4.17 | 0.89 | 0.75 |
con | 860 | 3.01 | 0.51 | 1.17 | 4.83 | 0.78 | 0.80 |
open | 860 | 2.51 | 0.62 | 0.92 | 4.33 | 0.76 | 0.62 |
diabetes | 857 | 0.12 | 0.32 | 0.00 | 1.00 | ||
highblood | 857 | 0.61 | 0.49 | 0.00 | 1.00 | ||
heart | 860 | 0.35 | 0.48 | 0.00 | 1.00 | ||
diabetes_diag | 761 | 0.04 | 0.19 | 0.00 | 1.00 | ||
highblood_diag | 337 | 0.35 | 0.48 | 0.00 | 1.00 | ||
heart_diag | 559 | 0.13 | 0.34 | 0.00 | 1.00 | ||
MIDUS | |||||||
age | 5988 | 46.85 | 12.91 | 20.00 | 75.00 | ||
gender | 5988 | 0.52 | 0.50 | 0.00 | 1.00 | ||
edu | 5988 | 6.87 | 2.49 | 1.00 | 12.00 | ||
bmi | 5988 | 26.65 | 5.29 | 9.00 | 64.00 | ||
has_cc | 5988 | 0.26 | 0.44 | 0.00 | 1.00 | ||
neur | 5988 | 2.23 | 0.66 | 1.00 | 4.00 | 0.75 | 0.74 |
con | 5988 | 3.43 | 0.44 | 1.00 | 4.00 | 0.56 | 0.53 |
extra | 5988 | 3.20 | 0.56 | 1.00 | 4.00 | 0.78 | 0.73 |
agree | 5988 | 3.49 | 0.49 | 1.00 | 4.00 | 0.81 | 0.77 |
open | 5988 | 3.02 | 0.53 | 1.00 | 4.00 | 0.78 | 0.66 |
diabetes | 5964 | 0.05 | 0.22 | 0.00 | 1.00 | ||
highblood | 5740 | 0.14 | 0.35 | 0.00 | 1.00 | ||
heart | 5988 | 0.11 | 0.31 | 0.00 | 1.00 | ||
diabetes_diag | 3404 | 0.12 | 0.32 | 0.00 | 1.00 | ||
highblood_diag | 2365 | 0.52 | 0.50 | 0.00 | 1.00 | ||
heart_diag | 4026 | 0.11 | 0.31 | 0.00 | 1.00 | ||
NAS | |||||||
age | 820 | 64.39 | 7.24 | 47.00 | 85.00 | ||
edu | 820 | 2.04 | 1.12 | 1.00 | 5.00 | ||
bmi | 820 | 26.87 | 3.52 | 16.57 | 44.22 | ||
has_cc | 820 | 0.49 | 0.50 | 0.00 | 1.00 | ||
neur | 820 | 4.29 | 0.91 | 1.40 | 7.22 | 0.85 | 0.74 |
con | 820 | 6.80 | 0.95 | 1.00 | 8.80 | 0.91 | 0.57 |
extra | 820 | 5.79 | 0.89 | 2.90 | 8.40 | 0.86 | 0.56 |
agree | 820 | 6.83 | 0.89 | 3.10 | 9.00 | 0.90 | 0.62 |
open | 820 | 6.13 | 0.93 | 1.00 | 8.79 | 0.88 | 0.55 |
diabetes | 820 | 0.11 | 0.31 | 0.00 | 1.00 | ||
highblood | 820 | 0.41 | 0.49 | 0.00 | 1.00 | ||
heart | 820 | 0.23 | 0.42 | 0.00 | 1.00 | ||
diabetes_diag | 730 | 0.05 | 0.21 | 0.00 | 1.00 | ||
highblood_diag | 485 | 0.18 | 0.38 | 0.00 | 1.00 | ||
heart_diag | 635 | 0.13 | 0.34 | 0.00 | 1.00 | ||
OATS | |||||||
age | 463 | 71.28 | 5.37 | 65.08 | 90.06 | ||
gender | 463 | 0.66 | 0.48 | 0.00 | 1.00 | ||
edu | 463 | 11.17 | 3.38 | 2.00 | 26.00 | ||
bmi | 463 | 27.13 | 4.39 | 15.61 | 44.99 | ||
has_cc | 463 | 0.79 | 0.41 | 0.00 | 1.00 | ||
neur | 463 | 2.35 | 0.61 | 1.00 | 4.25 | 0.86 | 0.68 |
con | 463 | 3.84 | 0.45 | 2.00 | 5.00 | 0.82 | 0.60 |
extra | 463 | 3.32 | 0.47 | 1.75 | 4.73 | 0.77 | 0.52 |
agree | 463 | 3.87 | 0.42 | 2.42 | 5.00 | 0.76 | 0.51 |
open | 463 | 3.32 | 0.49 | 2.00 | 4.75 | 0.76 | 0.55 |
diabetes | 463 | 0.10 | 0.30 | 0.00 | 1.00 | ||
highblood | 461 | 0.52 | 0.50 | 0.00 | 1.00 | ||
heart | 463 | 0.25 | 0.43 | 0.00 | 1.00 | ||
diabetes_diag | 418 | 0.03 | 0.16 | 0.00 | 1.00 | ||
highblood_diag | 223 | 0.17 | 0.38 | 0.00 | 1.00 | ||
heart_diag | 349 | 0.07 | 0.26 | 0.00 | 1.00 | ||
ROS | |||||||
age | 1326 | 75.94 | 7.43 | 55.78 | 102.15 | ||
gender | 1326 | 0.71 | 0.45 | 0.00 | 1.00 | ||
edu | 1326 | 18.34 | 3.31 | 3.00 | 30.00 | ||
bmi | 1326 | 27.53 | 5.59 | 11.16 | 55.41 | ||
has_cc | 1326 | 0.50 | 0.50 | 0.00 | 1.00 | ||
neur | 1326 | 2.39 | 0.48 | 1.00 | 4.00 | 0.80 | 0.57 |
con | 1326 | 3.84 | 0.42 | 1.92 | 5.00 | 0.80 | 0.61 |
extra | 1326 | 4.16 | 0.52 | 2.50 | 5.67 | 0.67 | 0.55 |
agree | 1326 | 2.22 | 0.34 | 1.08 | 3.50 | 0.68 | 0.52 |
open | 1326 | 2.86 | 0.44 | 1.33 | 4.75 | 0.68 | 0.60 |
diabetes | 1326 | 0.13 | 0.34 | 0.00 | 1.00 | ||
highblood | 1326 | 0.45 | 0.50 | 0.00 | 1.00 | ||
heart | 1326 | 0.10 | 0.30 | 0.00 | 1.00 | ||
diabetes_diag | 1155 | 0.11 | 0.32 | 0.00 | 1.00 | ||
highblood_diag | 732 | 0.37 | 0.48 | 0.00 | 1.00 | ||
heart_diag | 1191 | 0.07 | 0.26 | 0.00 | 1.00 | ||
SLS | |||||||
age | 876 | 68.27 | 13.63 | 29.00 | 100.00 | ||
gender | 876 | 0.56 | 0.50 | 0.00 | 1.00 | ||
edu | 876 | 15.72 | 2.63 | 8.00 | 20.00 | ||
bmi | 876 | 27.28 | 5.70 | 15.33 | 68.41 | ||
has_cc | 876 | 0.85 | 0.36 | 0.00 | 1.00 | ||
neur | 876 | 1.59 | 0.44 | 0.42 | 3.12 | 0.93 | 0.66 |
con | 876 | 2.50 | 0.36 | 1.21 | 3.73 | 0.90 | 0.60 |
extra | 876 | 2.18 | 0.40 | 0.85 | 3.29 | 0.90 | 0.49 |
agree | 876 | 2.70 | 0.32 | 1.56 | 3.69 | 0.87 | 0.58 |
open | 876 | 2.39 | 0.40 | 0.98 | 3.67 | 0.90 | 0.50 |
diabetes | 650 | 0.18 | 0.38 | 0.00 | 1.00 | ||
highblood | 872 | 0.46 | 0.50 | 0.00 | 1.00 | ||
heart | 653 | 0.72 | 0.45 | 0.00 | 1.00 | ||
highblood_diag | 285 | 0.30 | 0.46 | 0.00 | 1.00 | ||
WLS | |||||||
age | 10560 | 53.72 | 4.45 | 33.00 | 75.00 | ||
gender | 10560 | 0.54 | 0.50 | 0.00 | 1.00 | ||
edu | 10560 | 13.70 | 2.56 | -3.00 | 21.00 | ||
bmi | 10560 | 26.00 | 6.46 | -3.00 | 43.00 | ||
has_cc | 10560 | 0.36 | 0.48 | 0.00 | 1.00 | ||
neur | 10560 | 3.22 | 0.98 | 1.00 | 6.00 | 0.77 | 0.56 |
con | 10560 | 4.84 | 0.70 | 1.50 | 6.00 | 0.65 | 0.51 |
extra | 10560 | 3.19 | 0.90 | 1.00 | 6.00 | 0.76 | 0.56 |
agree | 10560 | 2.27 | 0.74 | 1.00 | 6.00 | 0.69 | 0.52 |
open | 10560 | 3.63 | 0.80 | 1.00 | 6.00 | 0.60 | 0.37 |
diabetes | 10555 | 0.04 | 0.20 | 0.00 | 1.00 | ||
highblood | 10554 | 0.23 | 0.42 | 0.00 | 1.00 | ||
heart | 10554 | 0.07 | 0.25 | 0.00 | 1.00 | ||
diabetes_diag | 7387 | 0.13 | 0.33 | 0.00 | 1.00 | ||
highblood_diag | 7259 | 0.46 | 0.50 | 0.00 | 1.00 | ||
heart_diag | 8746 | 0.19 | 0.39 | 0.00 | 1.00 |
The following packages were used to generate this table:
library(papaja)
library(tidyverse)
library(knitr)
library(kableExtra)
library(here)
The files needed for this table are available at osf.io/mzfu9 in the Individual Study Output folder.
First we load the individual study analysis objects.
study.names = c("BASEII", "EAS","ELSA", "HRS", "ILSE", "LBC",
"LBLS","MAP", "MAS", "MIDUS", "NAS", "OATS", "ROS", "SLS","WLS")
load(here("chronic/created data/BASEII_cc_output_nosrh.Rdata"))
load(here("chronic/created data/EAS_cc_nosrh_output.Rdata"))
load(here("chronic/created data/ELSA_cc_output_nosrh.Rdata"))
load(here("chronic/created data/HRS_cc_output_nosrh.Rdata"))
load(here("chronic/created data/ILSE_cc_output_nosrh.Rdata"))
load(here("chronic/created data/LBC_cc_output.Rdata"))
load(here("chronic/created data/MAP_cc_output.Rdata"))
load(here("chronic/created data/MAS_cc_output_nosrh.Rdata"))
load(here("chronic/created data/MIDUS_cc_output_nosrh.Rdata"))
load(here("chronic/created data/nas_cc_output_nosrh.Rdata"))
load(here("chronic/created data/OATS_cc_output_nosrh.Rdata"))
load(here("chronic/created data/ROS_cc_output.Rdata"))
load(here("chronic/created data/SLS_cc_output_nosrh.Rdata"))
load(here("chronic/created data/WLS_cc_output_nosrh.Rdata"))
load(here("chronic/created data/LBLS_cc_output_nosrh.Rdata"))
#these lines of code simply rename the data objects which are in lower case or have years. this allows for aesthetic consistency in graphs and tables
NAS_cc_output = nas_cc_output
rm(nas_cc_output)
We extract the relevant statistics in a loop. (The first author is just learning how to use the purrr
package, and so often resorts to loops when under a time constraint.)
First we extract the Cronbach’s alpha and omega values from the data objects. These are stored in a dataframe, with each reliability coefficient from each perosnality meausre from each study comprising a single row.
alpha.list <- data.frame()
n = 0
for(i in study.names){
n = n+1
x = get(paste0(i,"_cc_output")) # get output object
if(!is.null(x$alpha)){
y = as.data.frame(c(unlist(x$alpha), unlist(x$omega)))
y$study = i
alpha.list = rbind(alpha.list, y)
}
}
The fit statistics had been extracted in long form (e.g., the alpha and omega values are in the same column and not named). This code adds a “variable” variable and then spreads the data frame, so each trait within each study has a single row.
alpha.list <- alpha.list %>%
mutate(var = rownames(.),
var = gsub("[0-9]", "", var)) %>%
separate(var, into = c("statistic", "var")) %>%
spread(key = statistic, value = `c(unlist(x$alpha), unlist(x$omega))`)
Next we extract and wrangle the descriptive statistics (a data frame created using the describe()
function in the psych
package).
describe.df = lapply(X = study.names, FUN = function(x) get(paste0(x,"_cc_output"))$descriptives) %>%
map2_df(., study.names, ~ mutate(.x, study = .y, var = rownames(.x))) %>%
# join the descriptives to the data set containing the reliability statistics
full_join(alpha.list) %>%
# select the columns we want to include in the table
select(study, var, n, mean, sd, min, max, alpha, omega) %>%
# select rows representing variables used in analyses
filter(var %in% c("age", "gender", "edu", "bmi", "has_cc",
"neur", "con", "extra", "agree", "open",
"diabetes", "diabetes_diag", "highblood", "highblood_diag", "heart", "heart_diag"))
We identify the rows corresponding to each data set. We then select the minimum and maximum rows as starting and end points for grouping.
rows.BASEII = which(describe.df$study == "BASEII"); rows.BASEII = c(min(rows.BASEII), max(rows.BASEII))
rows.EAS = which(describe.df$study == "EAS"); rows.EAS = c(min(rows.EAS), max(rows.EAS))
rows.ELSA = which(describe.df$study == "ELSA"); rows.ELSA = c(min(rows.ELSA), max(rows.ELSA))
rows.HRS = which(describe.df$study == "HRS"); rows.HRS = c(min(rows.HRS), max(rows.HRS))
rows.ILSE = which(describe.df$study == "ILSE"); rows.ILSE = c(min(rows.ILSE), max(rows.ILSE))
rows.LBC = which(describe.df$study == "LBC"); rows.LBC = c(min(rows.LBC), max(rows.LBC))
rows.LBLS = which(describe.df$study == "LBLS"); rows.LBLS = c(min(rows.LBLS), max(rows.LBLS))
rows.MAP = which(describe.df$study == "MAP"); rows.MAP = c(min(rows.MAP), max(rows.MAP))
rows.MAS = which(describe.df$study == "MAS"); rows.MAS = c(min(rows.MAS), max(rows.MAS))
rows.MIDUS = which(describe.df$study == "MIDUS"); rows.MIDUS = c(min(rows.MIDUS), max(rows.MIDUS))
rows.NAS = which(describe.df$study == "NAS"); rows.NAS = c(min(rows.NAS), max(rows.NAS))
rows.OATS = which(describe.df$study == "OATS"); rows.OATS = c(min(rows.OATS), max(rows.OATS))
rows.ROS = which(describe.df$study == "ROS"); rows.ROS = c(min(rows.ROS), max(rows.ROS))
rows.SLS = which(describe.df$study == "SLS"); rows.SLS = c(min(rows.SLS), max(rows.SLS))
rows.WLS = which(describe.df$study == "WLS"); rows.WLS = c(min(rows.WLS), max(rows.WLS))
Finally, we pipe the data frame into the kable()
function and additional formatting through the kableExtra
package. We remove the study column, as this becomes redundant with the grouping headers.
describe.df %>%
select(-study) %>%
kable(., booktabs = T, escape = F, digits = 2, format = "html",
col.names = c("Variable", "N Valid", "Mean", "SD", "Min", "Max", "$\\alpha$", "$\\omega$")) %>%
kable_styling(full_width = T, latex_options = c("repeat_header")) %>%
group_rows("BASEII", rows.BASEII[1], rows.BASEII[2]) %>%
group_rows("EAS", rows.EAS[1], rows.EAS[2]) %>%
group_rows("ELSA", rows.ELSA[1], rows.ELSA[2]) %>%
group_rows("HRS", rows.HRS[1], rows.HRS[2]) %>%
group_rows("ILSE", rows.ILSE[1], rows.ILSE[2]) %>%
group_rows("LBC", rows.LBC[1], rows.LBC[2]) %>%
group_rows("LBLS", rows.LBLS[1], rows.LBLS[2]) %>%
group_rows("MAP", rows.MAP[1], rows.MAP[2]) %>%
group_rows("MAS", rows.MAS[1], rows.MAS[2]) %>%
group_rows("MIDUS", rows.MIDUS[1], rows.MIDUS[2]) %>%
group_rows("NAS", rows.NAS[1], rows.NAS[2]) %>%
group_rows("OATS", rows.OATS[1], rows.OATS[2]) %>%
group_rows("ROS", rows.ROS[1], rows.ROS[2]) %>%
group_rows("SLS", rows.SLS[1], rows.SLS[2]) %>%
group_rows("WLS", rows.WLS[1], rows.WLS[2])