This document contains the summaries of the regression analyses with smoking status as the outcome and all covariates included. We provide the code used to generate this table, which calls upon our analysis summary objects (also provided).

Main Effects

BASEII
EAS
ELSA
HRS
ILSE
LBLS
LBC
MAP
MAS
MIDUS
NAS
OATS
ROS
SLS
WLS
Term Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p
Intercept -3.63 0.26 0.03 -13.97 < .001 1.14 0.08 3.14 13.82 < .001 -4.35 0.10 0.01 -45.12 < .001 -2.68 0.03 0.07 -90.75 < .001 -1.09 0.12 0.34 -8.77 < .001 1.92 0.1 6.85 19.61 < .001 0.59 0.06 1.80 9.44 < .001 -4.58 0.32 0.01 -14.37 < .001 2.01 0.10 7.48 19.21 < .001 -3.26 0.09 0.04 -37.96 < .001 -1.32 0.09 0.27 -14.03 < .001 -3.16 0.22 0.04 -14.11 < .001 -6.72 0.83 0.00 -8.07 < .001 -2.33 0.10 0.10 -22.74 < .001 0.22 0.02 1.24 10.81 < .001
Neur -0.14 0.25 0.87 -0.57 .569 0.07 0.09 1.07 0.74 .460 0.04 0.10 1.04 0.44 .660 0.12 0.03 1.12 3.90 < .001 -0.27 0.13 0.76 -2.05 .040 -0.29 0.1 0.75 -2.88 .004 -0.09 0.06 0.91 -1.40 .160 0.08 0.34 1.08 0.24 .812 0.05 0.11 1.05 0.43 .666 0.28 0.08 1.32 3.57 < .001 0.07 0.10 1.08 0.72 .470 0.09 0.22 1.09 0.39 .696 -1.07 0.72 0.34 -1.48 .138 -0.18 0.12 0.83 -1.53 .125 -0.08 0.02 0.92 -3.78 < .001
Con -0.39 0.23 0.68 -1.70 .089 0.01 0.09 1.01 0.09 .932 -0.15 0.09 0.86 -1.66 .097 0.01 0.03 1.01 0.23 .821 -0.05 0.13 0.96 -0.35 .725 -0.23 0.1 0.79 -2.22 .027 0.13 0.06 1.14 2.04 .041 0.04 0.34 1.05 0.13 .897 -0.06 0.11 0.94 -0.57 .570 -0.18 0.08 0.84 -2.32 .020 -0.14 0.10 0.87 -1.34 .180 -0.30 0.22 0.74 -1.38 .168 -0.79 0.45 0.45 -1.73 .083 -0.17 0.12 0.85 -1.41 .159 -0.03 0.02 0.97 -1.57 .116
N 620.00 798.00 8647.00 19206.00 351.00 962.00 1143.00 982.00 879.00 4009.00 683.00 535.00 1394.00 1194.00 10206.00

Interaction, no covariates

BASEII
EAS
ELSA
HRS
ILSE
LBLS
LBC
MAP
MAS
MIDUS
NAS
OATS
ROS
SLS
WLS
Term Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p
Intercept -3.63 0.26 0.03 -13.79 < .001 1.20 0.09 3.31 13.26 < .001 -4.35 0.10 0.01 -44.49 < .001 -2.67 0.03 0.07 -88.80 < .001 -1.09 0.13 0.34 -8.49 < .001 2.00 0.11 7.41 18.61 < .001 0.56 0.06 1.75 8.89 < .001 -4.50 0.32 0.01 -14.12 < .001 1.95 0.11 7.01 17.32 < .001 -3.26 0.09 0.04 -37.70 < .001 -1.31 0.10 0.27 -13.08 < .001 -3.12 0.23 0.04 -13.54 < .001 -6.58 0.84 0.00 -7.84 < .001 -2.31 0.11 0.10 -21.12 < .001 0.23 0.02 1.25 11.01 < .001
Neur -0.14 0.25 0.87 -0.56 .576 0.06 0.09 1.06 0.63 .531 0.04 0.10 1.04 0.39 .693 0.12 0.03 1.12 3.95 < .001 -0.27 0.13 0.76 -2.03 .042 -0.31 0.10 0.73 -3.05 .002 -0.08 0.06 0.93 -1.17 .243 0.02 0.34 1.02 0.06 .955 0.09 0.11 1.09 0.77 .440 0.29 0.08 1.34 3.69 < .001 0.06 0.10 1.07 0.61 .540 0.24 0.23 1.27 1.01 .311 -0.94 0.80 0.39 -1.17 .241 -0.18 0.12 0.84 -1.48 .140 -0.08 0.02 0.92 -3.95 < .001
Con -0.39 0.23 0.68 -1.69 .090 -0.03 0.10 0.97 -0.31 .755 -0.15 0.09 0.86 -1.58 .113 0.00 0.03 1.00 -0.14 .891 -0.05 0.13 0.96 -0.35 .730 -0.30 0.11 0.74 -2.73 .006 0.13 0.07 1.14 1.92 .055 -0.01 0.34 0.99 -0.03 .977 -0.13 0.12 0.88 -1.05 .293 -0.21 0.08 0.81 -2.53 .011 -0.14 0.10 0.87 -1.40 .161 -0.43 0.24 0.65 -1.81 .070 -0.55 0.74 0.58 -0.74 .458 -0.16 0.12 0.85 -1.40 .161 -0.04 0.02 0.96 -1.73 .084
Neur x con 0.00 0.21 1.00 -0.01 .992 -0.11 0.07 0.89 -1.61 .108 -0.02 0.08 0.98 -0.23 .822 0.05 0.03 1.05 1.68 .093 0.01 0.12 1.01 0.04 .966 0.16 0.07 1.17 2.15 .032 -0.14 0.05 0.87 -2.62 .009 0.43 0.33 1.54 1.32 .186 -0.19 0.14 0.83 -1.38 .168 0.06 0.07 1.07 0.94 .348 0.05 0.11 1.05 0.44 .663 0.34 0.21 1.41 1.62 .105 0.32 0.75 1.37 0.42 .676 0.05 0.09 1.06 0.62 .537 0.04 0.02 1.04 2.22 .027
N 620.00 798.00 8647.00 19206.00 351.00 962.00 1143.00 982.00 879.00 4009.00 683.00 535.00 1394.00 1194.00 10206.00

Interaction, demographics

BASEII
EAS
ELSA
HRS
ILSE
LBLS
LBC
MAP
MAS
MIDUS
NAS
OATS
ROS
SLS
WLS
Term Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p
Intercept -2.74 0.41 0.06 -6.68 < .001 2.46 0.49 11.76 5.02 < .001 -3.57 0.22 0.03 -16.49 < .001 -2.09 0.06 0.12 -34.79 < .001 -20.85 828.99 0.00 -0.03 .980 6.87 2.35 965.05 2.93 .003 1.06 0.14 2.88 7.37 < .001 -4.72 1.55 0.01 -3.05 .002 1.93 0.66 6.87 2.93 .003 -2.69 0.11 0.07 -24.75 < .001 -0.88 0.21 0.42 -4.21 < .001 -0.08 1.23 0.92 -0.06 .948 -3.70 2.37 0.02 -1.56 .118 -2.46 0.21 0.09 -11.93 < .001 0.43 0.04 1.53 12.01 < .001
Age -0.51 0.27 0.60 -1.90 .057 -0.15 0.08 0.86 -1.76 .079 -0.28 0.11 0.76 -2.52 .012 -0.34 0.03 0.71 -10.66 < .001 0.09 0.15 1.10 0.62 .535 -0.15 0.10 0.86 -1.54 .124 -0.25 0.07 0.78 -3.72 < .001 0.08 0.32 1.09 0.25 .799 -0.03 0.11 0.97 -0.32 .745 -0.80 0.10 0.45 -7.93 < .001 -0.27 0.10 0.76 -2.64 .008 -0.83 0.33 0.43 -2.49 .013 -0.81 0.74 0.45 -1.10 .273 -0.03 0.11 0.97 -0.28 .778 -0.09 0.02 0.91 -4.26 < .001
Gender -0.85 0.52 0.43 -1.64 .102 -0.68 0.18 0.51 -3.71 < .001 -0.92 0.21 0.40 -4.42 < .001 -0.26 0.06 0.77 -4.27 < .001 19.62 828.98 332833619.44 0.02 .981 -0.82 0.21 0.44 -3.90 < .001 -0.24 0.13 0.79 -1.83 .067 -0.50 0.69 0.61 -0.73 .466 0.60 0.22 1.82 2.66 .008 -1.02 0.18 0.36 -5.81 < .001 -0.28 0.47 0.76 -0.59 .555 -0.97 1.31 0.38 -0.74 .458 0.29 0.21 1.34 1.38 .169 -0.23 0.04 0.80 -5.57 < .001
Edu -0.21 0.26 0.81 -0.83 .408 0.14 0.09 1.15 1.66 .097 0.31 0.11 1.37 2.90 .004 0.17 0.03 1.18 5.16 < .001 -0.04 0.17 0.96 -0.26 .795 0.19 0.11 1.21 1.83 .067 0.09 0.07 1.10 1.37 .172 0.64 0.29 1.89 2.21 .027 0.10 0.11 1.10 0.87 .386 -0.43 0.09 0.65 -4.73 < .001 -0.45 0.12 0.64 -3.70 < .001 -0.63 0.27 0.53 -2.34 .019 0.72 0.59 2.05 1.22 .221 0.25 0.11 1.28 2.32 .020 0.09 0.02 1.09 4.23 < .001
Neur -0.14 0.27 0.87 -0.52 .602 -0.01 0.10 0.99 -0.10 .923 0.06 0.10 1.06 0.56 .574 0.10 0.03 1.11 3.27 .001 0.12 0.17 1.13 0.68 .495 -0.23 0.11 0.80 -2.13 .034 -0.07 0.07 0.93 -1.02 .310 0.18 0.36 1.19 0.50 .619 0.06 0.12 1.06 0.47 .637 0.21 0.08 1.23 2.53 .011 0.08 0.11 1.08 0.74 .461 0.10 0.24 1.11 0.42 .672 -0.66 0.77 0.52 -0.85 .394 -0.17 0.12 0.85 -1.40 .161 -0.05 0.02 0.95 -2.56 .011
Con -0.33 0.24 0.72 -1.39 .164 -0.02 0.10 0.98 -0.17 .866 -0.20 0.10 0.82 -2.03 .043 -0.06 0.03 0.95 -1.77 .077 -0.10 0.17 0.91 -0.59 .558 -0.25 0.11 0.78 -2.24 .025 0.12 0.07 1.13 1.82 .070 -0.03 0.35 0.97 -0.08 .935 -0.13 0.12 0.88 -1.05 .296 -0.17 0.08 0.84 -2.04 .042 -0.20 0.10 0.82 -1.91 .056 -0.50 0.25 0.60 -2.03 .042 -0.32 0.66 0.72 -0.49 .623 -0.18 0.12 0.84 -1.53 .127 -0.03 0.02 0.97 -1.23 .219
Neur x con -0.02 0.23 0.98 -0.07 .940 -0.14 0.07 0.87 -1.95 .051 0.00 0.08 1.00 0.04 .965 0.06 0.03 1.06 2.04 .042 0.00 0.16 1.00 0.00 .996 0.18 0.08 1.19 2.29 .022 -0.13 0.05 0.88 -2.41 .016 0.47 0.35 1.60 1.34 .181 -0.17 0.14 0.84 -1.25 .212 0.04 0.07 1.04 0.50 .615 0.03 0.11 1.03 0.29 .769 0.31 0.22 1.36 1.38 .169 0.24 0.65 1.27 0.37 .708 0.06 0.09 1.06 0.72 .474 0.04 0.02 1.04 2.16 .031
N 620.00 798.00 8647.00 19206.00 351.00 962.00 1143.00 982.00 879.00 4009.00 683.00 535.00 1394.00 1194.00 10206.00

Interaction, all covariates

BASEII
EAS
ELSA
HRS
ILSE
LBLS
LBC
MAP
MAS
MIDUS
NAS
OATS
ROS
SLS
WLS
Term Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p Est SE OR t value p
Intercept -2.87 0.44 0.06 -6.59 < .001 2.53 0.50 12.58 5.04 < .001 -3.67 0.22 0.03 -16.38 < .001 -2.16 0.06 0.12 -34.69 < .001 -21.02 827.07 0.00 -0.03 .980 6.98 2.37 1079.51 2.95 .003 1.01 0.15 2.75 6.96 < .001 -4.97 2.82 0.01 -1.76 .078 1.87 0.66 6.46 2.82 .005 -2.72 0.12 0.07 -23.28 < .001 -0.85 0.21 0.43 -4.07 < .001 -0.29 1.24 0.75 -0.24 .813 -4.06 2.46 0.02 -1.65 .100 -2.48 0.21 0.08 -11.70 < .001 0.43 0.04 1.54 12.01 < .001
Age -0.51 0.27 0.60 -1.86 .062 -0.15 0.09 0.86 -1.80 .071 -0.26 0.11 0.77 -2.39 .017 -0.33 0.03 0.72 -10.22 < .001 0.11 0.15 1.11 0.70 .485 -0.16 0.10 0.85 -1.60 .110 -0.22 0.07 0.80 -3.30 .001 0.06 0.61 1.06 0.10 .919 -0.02 0.11 0.98 -0.21 .836 -0.79 0.10 0.46 -7.75 < .001 -0.29 0.10 0.75 -2.76 .006 -0.85 0.33 0.43 -2.56 .010 -0.73 0.76 0.48 -0.97 .333 -0.01 0.11 0.99 -0.06 .952 -0.09 0.02 0.91 -4.22 < .001
Gender -0.77 0.54 0.46 -1.44 .149 -0.72 0.19 0.49 -3.84 < .001 -0.83 0.21 0.43 -3.89 < .001 -0.19 0.06 0.82 -3.10 .002 19.63 827.06 334684585.58 0.02 .981 -0.78 0.23 0.46 -3.43 .001 -0.21 0.13 0.81 -1.62 .105 -2.16 1.20 0.12 -1.81 .071 0.62 0.23 1.85 2.73 .006 -1.00 0.19 0.37 -5.36 < .001 0.01 0.50 1.01 0.03 .978 -0.97 1.34 0.38 -0.73 .468 0.26 0.22 1.30 1.18 .239 -0.24 0.04 0.79 -5.69 < .001
Edu -0.27 0.26 0.77 -1.01 .311 0.12 0.10 1.13 1.29 .197 0.25 0.11 1.29 2.26 .024 0.14 0.03 1.15 4.31 < .001 -0.01 0.17 0.99 -0.04 .966 0.18 0.11 1.20 1.62 .105 0.09 0.07 1.09 1.26 .209 0.66 0.41 1.93 1.59 .111 0.06 0.12 1.07 0.54 .590 -0.44 0.09 0.65 -4.72 < .001 -0.45 0.12 0.64 -3.74 < .001 -0.64 0.28 0.53 -2.28 .022 0.71 0.63 2.03 1.12 .262 0.19 0.11 1.21 1.67 .095 0.08 0.02 1.08 3.50 < .001
Agree 0.08 0.27 1.08 0.29 .771 0.07 0.10 1.07 0.70 .482 -0.21 0.12 0.81 -1.76 .079 -0.17 0.04 0.85 -4.44 < .001 0.04 0.16 1.04 0.24 .812 -0.12 0.11 0.89 -1.04 .297 0.17 0.08 1.19 2.23 .026 -0.07 0.10 0.94 -0.68 .494 0.04 0.14 1.04 0.31 .759 -0.40 0.27 0.67 -1.49 .137 -0.22 0.62 0.81 -0.35 .729 -0.01 0.11 0.99 -0.05 .962 0.00 0.02 1.00 0.05 .959
Extra -0.39 0.26 0.68 -1.48 .138 0.15 0.10 1.16 1.55 .122 0.15 0.14 1.16 1.10 .273 0.18 0.04 1.19 4.35 < .001 0.18 0.18 1.20 0.98 .328 0.06 0.11 1.06 0.54 .591 0.10 0.08 1.11 1.29 .198 -0.30 0.55 0.74 -0.55 .579 0.19 0.11 1.21 1.76 .078 -0.12 0.12 0.88 -1.03 .304 -0.39 0.25 0.68 -1.54 .124 0.39 0.74 1.47 0.53 .598 -0.16 0.12 0.85 -1.34 .181 0.05 0.02 1.05 2.43 .015
Open 0.24 0.28 1.27 0.84 .398 0.05 0.10 1.05 0.45 .656 0.23 0.13 1.26 1.69 .092 0.13 0.04 1.13 3.20 .001 -0.13 0.17 0.88 -0.77 .440 0.11 0.10 1.11 1.03 .303 -0.03 0.08 0.97 -0.34 .734 -0.17 0.13 0.85 -1.24 .213 0.10 0.10 1.10 0.94 .347 0.02 0.13 1.02 0.12 .902 -0.06 0.24 0.95 -0.24 .812 0.11 0.67 1.12 0.17 .864 0.23 0.12 1.25 1.81 .071 0.03 0.02 1.03 1.15 .250
Neur -0.18 0.27 0.84 -0.65 .515 -0.08 0.11 0.92 -0.72 .470 0.09 0.10 1.10 0.90 .368 0.13 0.03 1.14 4.15 < .001 0.18 0.18 1.19 0.96 .335 -0.23 0.12 0.80 -1.94 .052 -0.13 0.08 0.88 -1.71 .087 -0.91 0.70 0.40 -1.30 .193 0.10 0.12 1.11 0.81 .416 0.25 0.08 1.28 2.95 .003 0.07 0.11 1.07 0.62 .535 -0.13 0.27 0.87 -0.50 .616 -0.64 0.87 0.52 -0.74 .461 -0.19 0.13 0.83 -1.50 .134 -0.04 0.02 0.96 -1.74 .082
Con -0.36 0.25 0.70 -1.42 .154 -0.07 0.10 0.93 -0.70 .485 -0.27 0.12 0.76 -2.34 .019 -0.10 0.04 0.90 -2.85 .004 -0.11 0.17 0.89 -0.66 .507 -0.24 0.12 0.79 -2.01 .045 0.13 0.07 1.13 1.69 .092 -0.92 0.50 0.40 -1.83 .067 -0.18 0.13 0.84 -1.38 .167 -0.22 0.09 0.80 -2.45 .014 -0.20 0.14 0.82 -1.46 .145 -0.35 0.27 0.71 -1.29 .197 -0.31 0.66 0.73 -0.48 .631 -0.15 0.12 0.86 -1.27 .205 -0.04 0.02 0.96 -1.71 .086
Neur x con -0.02 0.23 0.98 -0.10 .918 -0.15 0.07 0.86 -2.05 .041 0.01 0.08 1.01 0.14 .886 0.06 0.03 1.06 2.18 .029 0.00 0.16 1.00 0.02 .982 0.18 0.08 1.19 2.24 .025 -0.14 0.05 0.87 -2.61 .009 -0.10 0.33 0.90 -0.31 .760 -0.13 0.14 0.88 -0.95 .344 0.04 0.07 1.04 0.56 .578 0.03 0.11 1.03 0.27 .788 0.38 0.24 1.46 1.57 .117 0.22 0.64 1.25 0.34 .730 0.07 0.09 1.07 0.78 .434 0.04 0.02 1.04 2.23 .026
N 620.00 798.00 8633.00 19175.00 351.00 962.00 1143.00 653.00 879.00 4007.00 683.00 535.00 1394.00 1194.00 10181.00

Code

Preparation

The following packages were used to generate this table:

library(papaja)
library(tidyverse)
library(tools)
library(psych)
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")

lapply(here(paste0("behavior/", study.names, "_behavior.Rdata")), load, .GlobalEnv)

Then we identify which studies have smoking as an outcome.

#identify which studies have active outcome
drinker.names = lapply(paste0(study.names,"_behavior"), 
                      FUN = function(x) rownames(get(x)$descriptives))
drinker.names = sapply(drinker.names, FUN = function(x) "drinker" %in% x)
drinker.names = study.names[drinker.names]
columns = unite(
  expand.grid(stat = c("estimate", "std.error", "OR", "statistic", "p.value"),
              study = drinker.names),
  columns, study, stat, sep="_")$columns
header = c(" " = 1, "BASEII" = 5, "EAS" = 5, "ELSA" = 5, "HRS" = 5, "ILSE" = 5, 
           "LBLS" = 5, "LBC" = 5, "MAP" = 5, "MAS" = 5, "MIDUS" = 5, "NAS" = 5, "OATS" = 5,  
           "ROS" = 5, "SLS" = 5, "WLS" = 5)

Main Effects

#sample size
drinker.n = data.frame(study = drinker.names, 
                      term = "N", estimate = 
                        sapply(X = drinker.names, FUN = function(x)
                          get(paste0(x,"_behavior"))$regression$main$drinker$n)) %>%
  mutate(study = paste0(study, "_estimate")) %>%
  spread(key = "study", value = "estimate")

lapply(X = drinker.names, FUN = function(x) get(paste0(x,"_behavior"))$regression$main$drinker$coef) %>%
  map2_df(., drinker.names, ~ mutate(.x, study = .y)) %>%
  mutate(OR = exp(estimate)) %>%
  gather(key = "key", value = "value", -study, -term) %>%
  unite(study_stat, study, key, sep="_") %>%
  filter(!is.infinite(value)) %>%
  spread(key = "study_stat", value = "value") %>%
  gather(key = "key", value = "value", which(grepl("p", names(.)))) %>%
  mutate(sig = value, 
    value = printp(value),
    value = cell_spec(value, "html", 
                      color = ifelse(sig >= .05 | is.na(sig), 
                                     "black", "red"))) %>%
    filter(!grepl("NA", value))%>%
    dplyr::select(-sig) %>%
    spread(key = "key", value = "value") %>%
    full_join(drinker.n) %>%
    mutate(term = gsub("\\(", "", term), 
           term = gsub("\\)", "", term),
           term = toTitleCase(term),
           term = gsub("\\:", " x ", term), 
          term = factor(term, 
                         levels = c("Intercept", "Age", "Gender", "Edu", "Agree", "Extra", "Open", 
                                    "Neur", "Con", "Neur x con", "N"))) %>%
    arrange(term) %>%
    dplyr::select(term, columns) %>%
    kable(.,  booktabs = T, escape = F, digits = 2, format = "html", 
          align=c(rep('c',times=ncol(.))),
          col.names = c("Term", rep(c("Est","SE","OR", "t value", "p"), length(drinker.names)))) %>%
    kable_styling("bordered", full_width = TRUE) %>%
  add_header_above(header = header) 

Interaction, no covariates

#sample size
drinker.n = data.frame(study = drinker.names, 
                      term = "N", estimate = 
                        sapply(X = drinker.names, FUN = function(x)
                          get(paste0(x,"_behavior"))$regression$intr$drinker$n)) %>%
  mutate(study = paste0(study, "_estimate")) %>%
  spread(key = "study", value = "estimate")

lapply(X = drinker.names, FUN = function(x) get(paste0(x,"_behavior"))$regression$intr$drinker$coef) %>%
  map2_df(., drinker.names, ~ mutate(.x, study = .y)) %>%
  mutate(OR = exp(estimate)) %>%
  gather(key = "key", value = "value", -study, -term) %>%
  unite(study_stat, study, key, sep="_") %>%
  filter(!is.infinite(value)) %>%
  spread(key = "study_stat", value = "value") %>%
  gather(key = "key", value = "value", which(grepl("p", names(.)))) %>%
  mutate(sig = value, 
    value = printp(value),
    value = cell_spec(value, "html", 
                      color = ifelse(sig >= .05 | is.na(sig), 
                                     "black", "red"))) %>%
    filter(!grepl("NA", value))%>%
    dplyr::select(-sig) %>%
    spread(key = "key", value = "value") %>%
    full_join(drinker.n) %>%
    mutate(term = gsub("\\(", "", term), 
           term = gsub("\\)", "", term),
           term = toTitleCase(term),
           term = gsub("\\:", " x ", term), 
           term = factor(term, 
                       levels = c("Intercept", "Age", "Gender", "Edu", "Agree", "Extra", "Open", 
                                  "Neur", "Con", "Neur x con", "N"))) %>%
  arrange(term) %>%
  dplyr::select(term, columns) %>%
  kable(.,  booktabs = T, escape = F, digits = 2, format = "html", 
        align=c(rep('c',times=ncol(.))),
        col.names = c("Term", rep(c("Est","SE","OR", "t value", "p"), length(drinker.names)))) %>%
  kable_styling("bordered", full_width = TRUE) %>%
add_header_above(header = header) 

Interaction, demographics

#sample size
drinker.n = data.frame(study = drinker.names, 
                      term = "N", estimate = 
                        sapply(X = drinker.names, FUN = function(x)
                          get(paste0(x,"_behavior"))$regression$cov1$drinker$n)) %>%
  mutate(study = paste0(study, "_estimate")) %>%
  spread(key = "study", value = "estimate")

lapply(X = drinker.names, FUN = function(x) get(paste0(x,"_behavior"))$regression$cov1$drinker$coef) %>%
  map2_df(., drinker.names, ~ mutate(.x, study = .y)) %>%
  mutate(OR = exp(estimate)) %>%
  gather(key = "key", value = "value", -study, -term) %>%
  unite(study_stat, study, key, sep="_") %>%
  filter(!is.infinite(value)) %>%
  spread(key = "study_stat", value = "value") %>%
  gather(key = "key", value = "value", which(grepl("p", names(.)))) %>%
  filter(!is.na(value)) %>%
  mutate(sig = value, 
    value = printp(value),
    value = cell_spec(value, "html", 
                      color = ifelse(sig >= .05 | is.na(sig), 
                                     "black", "red"))) %>%
    filter(!grepl("NA", value))%>%
    dplyr::select(-sig) %>%
    spread(key = "key", value = "value") %>%
    full_join(drinker.n) %>%
    mutate(term = gsub("\\(", "", term), 
           term = gsub("\\)", "", term),
           term = toTitleCase(term),
           term = gsub("\\:", " x ", term), 
           term = factor(term, 
                         levels = c("Intercept", "Age", "Gender", "Edu", "Agree", "Extra", "Open", 
                                    "Neur", "Con", "Neur x con", "N"))) %>%
    arrange(term) %>%
    dplyr::select(term, columns) %>%
    kable(.,  booktabs = T, escape = F, digits = 2, format = "html", 
          align=c(rep('c',times=ncol(.))),
          col.names = c("Term", rep(c("Est","SE","OR", "t value", "p"), length(drinker.names)))) %>%
    kable_styling("bordered", full_width = TRUE) %>%
  add_header_above(header = header)  

Interaction, all covariates

#sample size
drinker.n = data.frame(study = drinker.names, 
                      term = "N", estimate = 
                        sapply(X = drinker.names, FUN = function(x)
                          get(paste0(x,"_behavior"))$regression$cov2$drinker$n)) %>%
  mutate(study = paste0(study, "_estimate")) %>%
  spread(key = "study", value = "estimate")

lapply(X = drinker.names, FUN = function(x) get(paste0(x,"_behavior"))$regression$cov2$drinker$coef) %>%
  map2_df(., drinker.names, ~ mutate(.x, study = .y)) %>%
  mutate(OR = exp(estimate)) %>%
  gather(key = "key", value = "value", -study, -term) %>%
  unite(study_stat, study, key, sep="_") %>%
  filter(!is.infinite(value)) %>%
  spread(key = "study_stat", value = "value") %>%
  gather(key = "key", value = "value", which(grepl("p", names(.)))) %>%
  filter(!is.na(value)) %>%
  mutate(sig = value, 
    value = printp(value),
    value = cell_spec(value, "html", 
                      color = ifelse(sig >= .05 | is.na(sig), 
                                     "black", "red"))) %>%
  filter(!grepl("NA", value)) %>%
  dplyr::select(-sig) %>%
  spread(key = "key", value = "value") %>%
  full_join(drinker.n) %>%
  mutate(term = gsub("\\(", "", term), 
         term = gsub("\\)", "", term),
         term = toTitleCase(term),
         term = gsub("\\:", " x ", term), 
         term = factor(term, 
                       levels = c("Intercept", "Age", "Gender", "Edu", "Agree", "Extra", "Open", 
                                  "Neur", "Con", "Neur x con", "N"))) %>%
  arrange(term) %>%
  dplyr::select(term, columns) %>%
  kable(.,  booktabs = T, escape = F, digits = 2, format = "html", 
        align=c(rep('c',times=ncol(.))),
        col.names = c("Term", rep(c("Est","SE","OR", "t value", "p"), length(drinker.names)))) %>%
  kable_styling("bordered", full_width = TRUE) %>%
add_header_above(header = header)