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 -2.04 0.08 0.13 -25.99 < .001 -3.12 0.18 0.04 -17.70 < .001 -1.97 0.03 0.14 -60.47 < .001 -1.74 0.02 0.18 -84.88 < .001 -1.30 0.11 0.27 -11.66 < .001 -2.18 0.11 0.11 -20.14 < .001 -2.33 0.1 0.10 -24.16 < .001 -4.62 0.33 0.01 -13.85 < .001 -3.46 0.21 0.03 -16.09 < .001 -1.80 0.05 0.16 -39.29 < .001 0.36 0.07 1.44 5.35 < .001 -2.88 0.20 0.06 -14.54 < .001 -4.20 0.22 0.02 -18.80 < .001 -3.30 0.16 0.04 -20.94 < .001 -1.57 0.03 0.21 -61.40 < .001
Neur -0.08 0.08 0.93 -0.95 .340 -0.09 0.19 0.92 -0.45 .655 0.07 0.03 1.08 2.24 .025 0.20 0.02 1.22 9.72 < .001 -0.14 0.12 0.87 -1.15 .252 0.15 0.11 1.16 1.34 .181 0.04 0.1 1.04 0.40 .692 0.30 0.32 1.35 0.94 .350 -0.81 0.21 0.44 -3.87 < .001 0.22 0.04 1.25 4.96 < .001 0.11 0.07 1.12 1.55 .121 0.12 0.20 1.13 0.62 .534 -0.03 0.23 0.97 -0.11 .912 0.12 0.17 1.13 0.68 .498 0.04 0.03 1.04 1.37 .170
Con -0.13 0.08 0.88 -1.67 .095 -0.02 0.19 0.98 -0.12 .904 -0.09 0.03 0.92 -2.65 .008 -0.08 0.02 0.92 -3.89 < .001 -0.07 0.12 0.93 -0.59 .556 -0.18 0.11 0.84 -1.61 .107 -0.11 0.1 0.89 -1.15 .251 0.30 0.34 1.35 0.87 .385 -0.28 0.18 0.76 -1.50 .133 -0.11 0.04 0.90 -2.49 .013 0.01 0.07 1.01 0.16 .872 -0.30 0.19 0.74 -1.55 .121 -0.19 0.22 0.83 -0.83 .407 -0.09 0.18 0.92 -0.49 .625 -0.01 0.03 0.99 -0.30 .761
N 1608.00 797.00 8832.00 19125.00 480.00 962.00 1341.00 974.00 874.00 4009.00 899.00 533.00 1394.00 1189.00 10723.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 -2.03 0.08 0.13 -25.79 < .001 -3.02 0.18 0.05 -16.97 < .001 -1.98 0.03 0.14 -59.56 < .001 -1.75 0.02 0.17 -83.40 < .001 -1.30 0.12 0.27 -11.20 < .001 -2.17 0.11 0.11 -19.40 < .001 -2.36 0.10 0.09 -23.72 < .001 -4.60 0.35 0.01 -13.13 < .001 -3.55 0.26 0.03 -13.91 < .001 -1.81 0.05 0.16 -38.94 < .001 0.37 0.07 1.44 5.05 < .001 -2.85 0.20 0.06 -14.01 < .001 -4.19 0.23 0.02 -18.31 < .001 -3.30 0.17 0.04 -19.77 < .001 -1.58 0.03 0.21 -59.65 < .001
Neur -0.08 0.08 0.93 -0.95 .340 -0.10 0.19 0.91 -0.53 .595 0.07 0.03 1.07 2.03 .042 0.19 0.02 1.21 9.29 < .001 -0.14 0.12 0.87 -1.14 .256 0.16 0.11 1.17 1.39 .165 0.04 0.10 1.04 0.43 .670 0.28 0.33 1.33 0.87 .383 -0.83 0.22 0.44 -3.84 < .001 0.22 0.04 1.25 4.89 < .001 0.11 0.08 1.12 1.45 .148 0.24 0.21 1.27 1.18 .238 -0.02 0.24 0.98 -0.09 .927 0.12 0.18 1.12 0.66 .507 0.04 0.03 1.04 1.45 .148
Con -0.13 0.08 0.88 -1.68 .093 -0.13 0.20 0.88 -0.66 .507 -0.07 0.03 0.93 -2.18 .029 -0.06 0.02 0.94 -2.77 .006 -0.07 0.12 0.93 -0.59 .555 -0.20 0.12 0.82 -1.67 .096 -0.12 0.10 0.89 -1.22 .224 0.28 0.35 1.33 0.81 .421 -0.41 0.25 0.67 -1.63 .103 -0.10 0.05 0.90 -2.20 .028 0.01 0.07 1.01 0.15 .884 -0.41 0.21 0.66 -1.96 .049 -0.19 0.22 0.83 -0.83 .405 -0.08 0.18 0.92 -0.46 .644 -0.01 0.03 0.99 -0.20 .839
Neur x con 0.01 0.07 1.01 0.18 .858 -0.38 0.19 0.69 -1.99 .046 -0.06 0.03 0.95 -2.04 .041 -0.06 0.02 0.94 -3.68 < .001 0.00 0.10 1.00 -0.04 .965 0.04 0.09 1.04 0.43 .665 -0.09 0.07 0.91 -1.41 .159 0.06 0.30 1.06 0.19 .851 -0.19 0.25 0.83 -0.78 .436 -0.02 0.04 0.98 -0.54 .586 0.01 0.07 1.01 0.17 .862 0.27 0.18 1.31 1.51 .132 0.01 0.18 1.01 0.08 .937 -0.01 0.12 0.99 -0.08 .935 -0.03 0.02 0.97 -1.16 .245
N 1608.00 797.00 8832.00 19125.00 480.00 962.00 1341.00 974.00 874.00 4009.00 899.00 533.00 1394.00 1189.00 10723.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 -1.59 0.11 0.20 -14.36 < .001 -1.01 1.04 0.37 -0.97 .331 -1.09 0.08 0.34 -14.24 < .001 -0.84 0.04 0.43 -19.94 < .001 -1.34 1.48 0.26 -0.90 .366 -0.02 2.55 0.98 -0.01 .994 -1.96 0.20 0.14 -10.02 < .001 -0.28 1.32 0.76 -0.21 .832 -2.40 1.13 0.09 -2.12 .034 -1.76 0.07 0.17 -23.75 < .001 0.30 0.15 1.35 1.97 .049 0.67 1.18 1.96 0.57 .568 -2.47 0.82 0.08 -3.00 .003 -2.71 0.25 0.07 -10.66 < .001 -1.39 0.04 0.25 -32.49 < .001
Age -0.61 0.07 0.54 -8.86 < .001 -0.39 0.19 0.68 -2.02 .044 -0.56 0.04 0.57 -14.57 < .001 -0.64 0.02 0.53 -26.98 < .001 -0.03 0.11 0.97 -0.24 .809 -0.09 0.11 0.91 -0.85 .394 -0.40 0.10 0.67 -4.09 < .001 -1.18 0.34 0.31 -3.52 < .001 -0.19 0.19 0.82 -1.04 .297 -0.46 0.05 0.63 -9.09 < .001 0.04 0.07 1.04 0.51 .609 -1.00 0.33 0.37 -3.06 .002 -0.23 0.24 0.80 -0.93 .351 -0.43 0.16 0.65 -2.73 .006 -0.18 0.03 0.83 -7.16 < .001
Gender -0.37 0.17 0.69 -2.20 .028 0.07 0.37 1.08 0.20 .845 -0.10 0.07 0.90 -1.51 .130 -0.21 0.04 0.81 -4.98 < .001 0.68 0.25 1.97 2.75 .006 -0.02 0.22 0.98 -0.09 .929 0.05 0.20 1.05 0.24 .814 -0.17 0.82 0.84 -0.21 .836 -0.04 0.37 0.96 -0.12 .905 0.06 0.10 1.06 0.64 .520 -0.06 0.43 0.94 -0.15 .884 -2.31 0.57 0.10 -4.03 < .001 -0.46 0.32 0.63 -1.44 .150 -0.15 0.05 0.86 -2.82 .005
Edu -0.01 0.08 0.99 -0.08 .934 -0.07 0.18 0.93 -0.41 .684 -0.50 0.04 0.61 -13.88 < .001 -0.29 0.02 0.75 -14.33 < .001 -0.26 0.12 0.77 -2.06 .039 -0.27 0.12 0.77 -2.26 .024 -0.59 0.11 0.55 -5.16 < .001 -0.53 0.37 0.59 -1.42 .154 -0.22 0.20 0.80 -1.09 .274 -0.56 0.05 0.57 -10.66 < .001 0.05 0.07 1.05 0.73 .468 -0.40 0.23 0.67 -1.76 .078 0.39 0.22 1.47 1.76 .078 -0.47 0.17 0.63 -2.71 .007 -0.35 0.03 0.70 -11.91 < .001
Neur -0.07 0.08 0.93 -0.88 .380 -0.11 0.19 0.90 -0.58 .563 -0.03 0.03 0.97 -1.00 .320 0.10 0.02 1.11 4.67 < .001 -0.12 0.13 0.88 -0.97 .333 0.12 0.12 1.13 1.06 .291 -0.09 0.11 0.91 -0.85 .395 0.08 0.31 1.08 0.25 .800 -0.80 0.22 0.45 -3.67 < .001 0.10 0.05 1.10 2.03 .042 0.11 0.08 1.11 1.39 .166 0.12 0.21 1.12 0.56 .572 0.18 0.24 1.20 0.78 .438 0.03 0.18 1.03 0.19 .849 0.00 0.03 1.00 0.15 .880
Con -0.03 0.08 0.97 -0.33 .742 -0.14 0.20 0.87 -0.70 .484 -0.11 0.03 0.90 -3.17 .002 -0.08 0.02 0.93 -3.47 .001 -0.11 0.12 0.90 -0.89 .376 -0.24 0.12 0.79 -1.95 .051 -0.12 0.10 0.88 -1.24 .216 -0.03 0.35 0.97 -0.08 .936 -0.43 0.25 0.65 -1.74 .082 -0.10 0.05 0.90 -2.19 .029 0.02 0.07 1.02 0.24 .814 -0.48 0.22 0.62 -2.20 .028 0.01 0.21 1.01 0.05 .964 -0.09 0.18 0.92 -0.50 .619 0.00 0.03 1.00 -0.02 .981
Neur x con 0.00 0.08 1.00 0.03 .976 -0.41 0.19 0.66 -2.12 .034 -0.03 0.03 0.97 -1.16 .245 -0.06 0.02 0.94 -3.22 .001 -0.01 0.11 0.99 -0.12 .904 0.04 0.09 1.04 0.44 .663 -0.08 0.07 0.92 -1.22 .222 -0.02 0.27 0.98 -0.09 .926 -0.18 0.24 0.83 -0.75 .456 -0.03 0.04 0.97 -0.75 .455 0.02 0.07 1.02 0.22 .823 0.21 0.19 1.23 1.12 .262 0.09 0.17 1.09 0.53 .598 -0.01 0.12 0.99 -0.06 .955 -0.02 0.02 0.98 -0.99 .321
N 1608.00 797.00 8832.00 19125.00 480.00 962.00 1341.00 974.00 874.00 4009.00 899.00 533.00 1394.00 1189.00 10723.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 -1.59 0.11 0.20 -14.23 < .001 -1.36 1.07 0.26 -1.27 .205 -1.09 0.08 0.34 -14.07 < .001 -0.84 0.04 0.43 -19.42 < .001 -1.62 1.49 0.20 -1.09 .277 0.06 2.56 1.06 0.02 .982 -2.00 0.20 0.14 -9.84 < .001 0.01 1.95 1.01 0.01 .994 -2.46 1.13 0.09 -2.17 .030 -1.75 0.08 0.17 -22.76 < .001 0.33 0.15 1.39 2.13 .033 0.20 1.21 1.22 0.17 .868 -2.64 0.84 0.07 -3.15 .002 -2.75 0.27 0.06 -10.15 < .001 -1.38 0.04 0.25 -31.72 < .001
Age -0.62 0.07 0.54 -8.88 < .001 -0.35 0.20 0.70 -1.78 .075 -0.57 0.04 0.57 -14.55 < .001 -0.63 0.02 0.53 -26.71 < .001 0.00 0.11 1.00 -0.04 .965 -0.11 0.11 0.90 -0.97 .331 -0.41 0.10 0.67 -4.12 < .001 -1.38 0.49 0.25 -2.81 .005 -0.18 0.19 0.83 -0.98 .328 -0.46 0.05 0.63 -9.13 < .001 0.02 0.07 1.02 0.28 .777 -0.95 0.33 0.39 -2.91 .004 -0.26 0.25 0.77 -1.07 .286 -0.44 0.16 0.65 -2.69 .007 -0.18 0.03 0.83 -7.16 < .001
Gender -0.41 0.17 0.67 -2.37 .018 0.17 0.38 1.18 0.44 .661 -0.13 0.07 0.88 -1.79 .073 -0.23 0.04 0.80 -5.12 < .001 0.62 0.26 1.87 2.43 .015 0.12 0.24 1.13 0.53 .599 0.07 0.20 1.07 0.34 .735 -0.15 1.14 0.86 -0.13 .897 -0.03 0.37 0.97 -0.08 .938 0.04 0.10 1.04 0.40 .693 0.21 0.47 1.23 0.44 .658 -2.09 0.58 0.12 -3.58 < .001 -0.48 0.34 0.62 -1.43 .153 -0.17 0.05 0.84 -3.12 .002
Edu -0.02 0.09 0.98 -0.20 .839 -0.09 0.20 0.91 -0.45 .656 -0.49 0.04 0.61 -13.30 < .001 -0.31 0.02 0.73 -14.89 < .001 -0.24 0.13 0.79 -1.83 .068 -0.22 0.12 0.80 -1.81 .070 -0.56 0.12 0.57 -4.82 < .001 -0.62 0.51 0.54 -1.23 .219 -0.26 0.21 0.77 -1.28 .200 -0.58 0.05 0.56 -10.83 < .001 0.05 0.07 1.05 0.73 .468 -0.49 0.24 0.62 -1.99 .046 0.46 0.23 1.59 2.02 .043 -0.44 0.18 0.64 -2.42 .016 -0.38 0.03 0.68 -12.15 < .001
Agree -0.09 0.08 0.91 -1.11 .266 -0.33 0.19 0.72 -1.70 .089 0.18 0.04 1.20 4.15 < .001 0.06 0.03 1.06 2.17 .030 -0.20 0.13 0.82 -1.58 .115 -0.13 0.12 0.88 -1.02 .308 -0.12 0.12 0.89 -1.00 .316 0.09 0.06 1.10 1.61 .107 0.09 0.10 1.09 0.84 .404 -0.57 0.24 0.57 -2.37 .018 -0.49 0.22 0.61 -2.18 .030 -0.02 0.17 0.98 -0.13 .896 0.01 0.03 1.01 0.41 .682
Extra 0.15 0.09 1.16 1.69 .092 0.35 0.21 1.42 1.70 .090 -0.10 0.05 0.90 -2.19 .028 -0.03 0.03 0.97 -1.25 .210 0.28 0.14 1.32 2.00 .046 0.02 0.13 1.02 0.19 .847 -0.23 0.13 0.79 -1.84 .065 0.36 0.41 1.44 0.89 .376 -0.08 0.06 0.92 -1.37 .171 -0.17 0.08 0.84 -2.01 .044 0.21 0.25 1.23 0.85 .394 0.12 0.25 1.13 0.48 .628 0.36 0.19 1.43 1.91 .056 0.01 0.03 1.01 0.19 .848
Open 0.18 0.09 1.19 1.95 .051 0.04 0.21 1.04 0.17 .868 0.11 0.04 1.12 2.55 .011 0.11 0.03 1.11 3.99 < .001 -0.02 0.12 0.98 -0.17 .867 -0.20 0.12 0.82 -1.75 .080 -0.23 0.12 0.80 -1.82 .068 -0.22 0.25 0.81 -0.85 .396 0.16 0.06 1.17 2.80 .005 0.14 0.09 1.15 1.48 .140 0.16 0.21 1.17 0.73 .463 -0.28 0.25 0.76 -1.13 .259 -0.23 0.18 0.79 -1.25 .211 0.08 0.03 1.09 2.83 .005
Neur -0.05 0.09 0.95 -0.60 .547 -0.03 0.21 0.97 -0.16 .870 -0.04 0.03 0.96 -1.20 .229 0.10 0.02 1.11 4.78 < .001 -0.09 0.14 0.92 -0.63 .532 0.09 0.13 1.09 0.67 .501 -0.15 0.12 0.86 -1.23 .219 0.30 0.35 1.35 0.86 .389 -0.72 0.24 0.49 -3.07 .002 0.11 0.05 1.12 2.38 .017 0.10 0.08 1.10 1.25 .212 0.03 0.24 1.03 0.13 .897 0.02 0.27 1.02 0.06 .955 0.10 0.19 1.11 0.56 .577 0.03 0.03 1.03 0.98 .329
Con -0.08 0.09 0.93 -0.88 .381 -0.19 0.21 0.82 -0.93 .352 -0.19 0.04 0.82 -4.77 < .001 -0.14 0.03 0.87 -5.29 < .001 -0.13 0.13 0.88 -1.02 .307 -0.23 0.13 0.80 -1.75 .080 0.00 0.11 1.00 0.01 .994 0.00 0.49 1.00 0.01 .992 -0.49 0.25 0.62 -1.91 .056 -0.15 0.05 0.86 -3.01 .003 -0.05 0.10 0.95 -0.54 .590 -0.36 0.23 0.70 -1.53 .126 0.04 0.22 1.05 0.20 .842 -0.14 0.18 0.87 -0.80 .423 -0.01 0.03 0.99 -0.37 .709
Neur x con 0.00 0.08 1.00 0.00 .998 -0.42 0.20 0.66 -2.13 .033 -0.03 0.03 0.97 -1.12 .264 -0.05 0.02 0.95 -2.78 .005 0.00 0.11 1.00 0.01 .989 0.03 0.09 1.03 0.34 .734 -0.10 0.07 0.91 -1.42 .156 -0.07 0.30 0.93 -0.25 .806 -0.12 0.25 0.88 -0.50 .620 -0.02 0.04 0.98 -0.47 .637 0.00 0.07 1.00 0.06 .955 0.20 0.20 1.23 1.04 .298 0.06 0.18 1.07 0.35 .725 -0.01 0.12 0.99 -0.11 .914 -0.02 0.02 0.98 -0.85 .393
N 1608.00 797.00 8817.00 19094.00 480.00 962.00 1341.00 646.00 874.00 4007.00 899.00 533.00 1394.00 1189.00 10698.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
smoker.names = lapply(paste0(study.names,"_behavior"), 
                      FUN = function(x) rownames(get(x)$descriptives))
smoker.names = sapply(smoker.names, FUN = function(x) "smoker" %in% x)
smoker.names = study.names[smoker.names]
columns = unite(
  expand.grid(stat = c("estimate", "std.error", "OR", "statistic", "p.value"),
              study = smoker.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
smoker.n = data.frame(study = smoker.names, 
                      term = "N", estimate = 
                        sapply(X = smoker.names, FUN = function(x)
                          get(paste0(x,"_behavior"))$regression$main$smoker$n)) %>%
  mutate(study = paste0(study, "_estimate")) %>%
  spread(key = "study", value = "estimate")

lapply(X = smoker.names, FUN = function(x) get(paste0(x,"_behavior"))$regression$main$smoker$coef) %>%
  map2_df(., smoker.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(smoker.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(smoker.names)))) %>%
    kable_styling("bordered", full_width = TRUE) %>%
  add_header_above(header = header) 

Interaction, no covariates

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

lapply(X = smoker.names, FUN = function(x) get(paste0(x,"_behavior"))$regression$intr$smoker$coef) %>%
  map2_df(., smoker.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(smoker.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(smoker.names)))) %>%
  kable_styling("bordered", full_width = TRUE) %>%
add_header_above(header) 

Interaction, demographics

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

lapply(X = smoker.names, FUN = function(x) get(paste0(x,"_behavior"))$regression$cov1$smoker$coef) %>%
  map2_df(., smoker.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(smoker.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(smoker.names)))) %>%
    kable_styling("bordered", full_width = TRUE) %>%
  add_header_above(header)  

Interaction, all covariates

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

lapply(X = smoker.names, FUN = function(x) get(paste0(x,"_behavior"))$regression$cov2$smoker$coef) %>%
  map2_df(., smoker.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(smoker.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(smoker.names)))) %>%
  kable_styling("bordered", full_width = TRUE) %>%
add_header_above(header)