quickReg

Xikun Han, [email protected]

2017-09-28

A manual to show the R package quickReg.

Introduction

The quickReg package concentrates on a set of functions to display and pry a dataset. More precisely, the package can display statistical description for a dataset, build regression models for lm, glm and cox regression based on specified variables. More importantly, the package provides several seamless functions to display these regressions. Several examples are used to explain the idea.

Getting started

The example data is a hypothetical dataset extracting a subset from package PredictABEL. It has no practical implications and only be used to demostrate the main idea of the package.

# If you haven't install the package, you can download it from cran

# install.packages("quickReg")

library(quickReg)
library(ggplot2)
library(rlang)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
# Load the dataset

data(diabetes)

# Show the first 6 rows of the data

head(diabetes)
##   sex age smoking education diabetes BMI systolic diastolic CFHrs1061170 LOCrs10490924 CFHrs1410996 C2rs9332739 CFBrs641153 CFHrs2230199
## 1   1  44       1         0        1  40      129        91            1             2            2           1           1            0
## 2   0  53       0         0        0  29      137        98            2             1            1           1           0            0
## 3   1  46       1         0        0  29      136        93            1             1            2           1           1            1
## 4   1  63       0         0        0  29      176       119            1             0            1           1           0            0
## 5   0  60      NA         0        1  30      148       107            1             2            1           1           0            2
## 6   0  52       0         1        1  29      133        91            1             1            1           1           1            0

We can use the function display_table or display_table_group to show statistical descriptions of the data.

display_1<-display_table(data=diabetes,variables=c("age","smoking","education"),group="CFHrs2230199")
display_1
##    variable      level     All sample CFHrs2230199 = 0 CFHrs2230199 = 1 CFHrs2230199 = 2 P.value1 P.value2                normality
## 1       age mean +- sd 58.98 +- 13.27   59.23 +- 13.36   58.34 +- 13.14   60.59 +- 13.16     0.36     0.47 6.45E-08; 3.01E-05; 0.24
## 2                   NA              0                0                0                0                                           
## 3   smoking          0   455 (49.14%)     259 (49.81%)      166 (48.4%)      30 (47.62%)     0.89     <NA>                         
## 4                    1   471 (50.86%)     261 (50.19%)      177 (51.6%)      33 (52.38%)                                           
## 5                   NA             74               38               33                3                                           
## 6 education          0    661 (66.1%)     370 (66.31%)     248 (65.96%)      43 (65.15%)     0.98     <NA>                         
## 7                    1    339 (33.9%)     188 (33.69%)     128 (34.04%)      23 (34.85%)                                           
## 8                   NA              0                0                0                0
# You could do a sub-group analysis by sex
display_2<-display_table_group(data=diabetes,variables=c("age","smoking"),group="CFHrs2230199",super_group = "sex")
display_2
## # A tibble: 10 x 10
##      sex variable      level   `All sample` `CFHrs2230199 = 0` `CFHrs2230199 = 1` `CFHrs2230199 = 2` P.value1 P.value2                normality
##    <dbl>    <chr>      <chr>          <chr>              <chr>              <chr>              <chr>    <chr>    <chr>                    <chr>
##  1     0      age mean +- sd 59.22 +- 13.72     59.94 +- 14.09     58.52 +- 13.38     57.54 +- 12.53     0.36     0.40 2.71E-05; 1.59E-03; 0.08
##  2     0                  NA              0                  0                  0                  0                                           
##  3     0  smoking          0   259 (49.05%)       142 (48.63%)       100 (50.51%)        17 (44.74%)     0.79     <NA>                         
##  4     0                   1   269 (50.95%)       150 (51.37%)        98 (49.49%)        21 (55.26%)                                           
##  5     0                  NA             44                 20                 21                  3                                           
##  6     1      age mean +- sd 58.66 +- 12.65     58.33 +- 12.34     58.08 +- 12.84     65.60 +- 12.86     0.02     0.02     3.56E-04; 0.01; 0.95
##  7     1                  NA              0                  0                  0                  0                                           
##  8     1  smoking          0   196 (49.25%)       117 (51.32%)        66 (45.52%)           13 (52%)     0.53     <NA>                         
##  9     1                   1   202 (50.75%)       111 (48.68%)        79 (54.48%)           12 (48%)                                           
## 10     1                  NA             30                 18                 12                  0
# You could do a sub-group analysis by two variables
display_3<-display_table_group(data=diabetes,variables=c("age","smoking"),group="CFHrs2230199",super_group = c("sex","education"))
display_3
##    super_group super_group_level variable      level     All sample CFHrs2230199 = 0 CFHrs2230199 = 1 CFHrs2230199 = 2 P.value1 P.value2
## 1          sex                 0      age mean +- sd 59.22 +- 13.72   59.94 +- 14.09   58.52 +- 13.38   57.54 +- 12.53     0.36     0.40
## 2          sex                 0                  NA              0                0                0                0                  
## 3          sex                 0  smoking          0   259 (49.05%)     142 (48.63%)     100 (50.51%)      17 (44.74%)     0.79     <NA>
## 4          sex                 0                   1   269 (50.95%)     150 (51.37%)      98 (49.49%)      21 (55.26%)                  
## 5          sex                 0                  NA             44               20               21                3                  
## 6          sex                 1      age mean +- sd 58.66 +- 12.65   58.33 +- 12.34   58.08 +- 12.84   65.60 +- 12.86     0.02     0.02
## 7          sex                 1                  NA              0                0                0                0                  
## 8          sex                 1  smoking          0   196 (49.25%)     117 (51.32%)      66 (45.52%)         13 (52%)     0.53     <NA>
## 9          sex                 1                   1   202 (50.75%)     111 (48.68%)      79 (54.48%)         12 (48%)                  
## 10         sex                 1                  NA             30               18               12                0                  
## 11   education                 0      age mean +- sd 58.68 +- 12.98   59.15 +- 12.95   57.73 +- 12.95   60.09 +- 13.36     0.31     0.49
## 12   education                 0                  NA              0                0                0                0                  
## 13   education                 0  smoking          0   307 (49.68%)     166 (47.56%)     126 (55.26%)      15 (36.59%)     0.04     <NA>
## 14   education                 0                   1   311 (50.32%)     183 (52.44%)     102 (44.74%)      26 (63.41%)                  
## 15   education                 0                  NA             43               21               20                2                  
## 16   education                 1      age mean +- sd 59.57 +- 13.81   59.37 +- 14.17   59.52 +- 13.48   61.52 +- 13.02     0.78     0.72
## 17   education                 1                  NA              0                0                0                0                  
## 18   education                 1  smoking          0   148 (48.05%)      93 (54.39%)      40 (34.78%)      15 (68.18%) 7.35E-04     <NA>
## 19   education                 1                   1   160 (51.95%)      78 (45.61%)      75 (65.22%)       7 (31.82%)                  
## 20   education                 1                  NA             31               17               13                1                  
##                   normality
## 1  2.71E-05; 1.59E-03; 0.08
## 2                          
## 3                          
## 4                          
## 5                          
## 6      3.56E-04; 0.01; 0.95
## 7                          
## 8                          
## 9                          
## 10                         
## 11 1.18E-05; 7.28E-04; 0.39
## 12                         
## 13                         
## 14                         
## 15                         
## 16 5.73E-04; 4.11E-03; 0.84
## 17                         
## 18                         
## 19                         
## 20
# Sub-group analysis can be a combination
display_4<-display_table_group(data=diabetes,variables=c("age","smoking"),group="CFHrs2230199",super_group = c("sex","education"),group_combine = TRUE)
display_4
## # A tibble: 20 x 11
##      sex education variable      level   `All sample` `CFHrs2230199 = 0` `CFHrs2230199 = 1` `CFHrs2230199 = 2` P.value1 P.value2            normality
##    <dbl>     <dbl>    <chr>      <chr>          <chr>              <chr>              <chr>              <chr>    <chr>    <chr>                <chr>
##  1     0         0      age mean +- sd 59.15 +- 13.47     60.08 +- 13.66     58.03 +- 13.20     58.52 +- 13.54     0.35     0.40 8.20E-04; 0.01; 0.13
##  2     0         0                  NA              0                  0                  0                  0                                       
##  3     0         0  smoking          0   181 (49.86%)        91 (46.91%)        81 (57.04%)         9 (33.33%)     0.04     <NA>                     
##  4     0         0                   1   182 (50.14%)       103 (53.09%)        61 (42.96%)        18 (66.67%)                                       
##  5     0         0                  NA             28                 13                 13                  2                                       
##  6     0         1      age mean +- sd 59.38 +- 14.28     59.66 +- 14.99     59.72 +- 13.84      55.17 +- 9.77     0.57     0.63     0.01; 0.07; 0.89
##  7     0         1                  NA              0                  0                  0                  0                                       
##  8     0         1  smoking          0    78 (47.27%)        51 (52.04%)        19 (33.93%)         8 (72.73%)     0.02     <NA>                     
##  9     0         1                   1    87 (52.73%)        47 (47.96%)        37 (66.07%)         3 (27.27%)                                       
## 10     0         1                  NA             16                  7                  8                  1                                       
## 11     1         0      age mean +- sd 58.00 +- 12.23     57.98 +- 11.94     57.24 +- 12.58     63.36 +- 12.83     0.22     0.25     0.01; 0.01; 0.94
## 12     1         0                  NA              0                  0                  0                  0                                       
## 13     1         0  smoking          0   126 (49.41%)        75 (48.39%)        45 (52.33%)         6 (42.86%)     0.74     <NA>                     
## 14     1         0                   1   129 (50.59%)        80 (51.61%)        41 (47.67%)         8 (57.14%)                                       
## 15     1         0                  NA             15                  8                  7                  0                                       
## 16     1         1      age mean +- sd 59.79 +- 13.29     59.01 +- 13.15     59.31 +- 13.22     68.45 +- 12.92     0.08     0.08     0.04; 0.04; 0.92
## 17     1         1                  NA              0                  0                  0                  0                                       
## 18     1         1  smoking          0    70 (48.95%)        42 (57.53%)        21 (35.59%)         7 (63.64%)     0.03     <NA>                     
## 19     1         1                   1    73 (51.05%)        31 (42.47%)        38 (64.41%)         4 (36.36%)                                       
## 20     1         1                  NA             15                 10                  5                  0

Build regression models

# Apply univariate regression models

reg_1<-reg_x(data = diabetes, y = 5, factors = c(1, 3, 4), model = 'glm')
reg_1
##                x          term      estimate   std.error   statistic      p.value        OR    OR.low  OR.high    N
## 1            sex         sex_1 -0.0995619364 0.163419266 -0.60924234 5.423638e-01 0.9052339 0.6571403 1.246992 1000
## 2            age           age -0.0016515166 0.006083056 -0.27149453 7.860107e-01 0.9983498 0.9865176 1.010324 1000
## 3        smoking     smoking_1  0.2203884367 0.171356638  1.28613889 1.983946e-01 1.2465608 0.8909523 1.744105  926
## 4      education   education_1  0.0072440035 0.169823173  0.04265615 9.659756e-01 1.0072703 0.7220916 1.405076 1000
## 5            BMI           BMI -0.0205541093 0.021530295 -0.95465990 3.397497e-01 0.9796557 0.9391757 1.021880  994
## 6       systolic      systolic -0.0001758354 0.004399858 -0.03996388 9.681219e-01 0.9998242 0.9912392 1.008484  995
## 7      diastolic     diastolic -0.0010196342 0.007323325 -0.13923104 8.892676e-01 0.9989809 0.9847445 1.013423  995
## 8   CFHrs1061170  CFHrs1061170  0.1648181445 0.108731134  1.51583211 1.295618e-01 1.1791787 0.9528565 1.459257 1000
## 9  LOCrs10490924 LOCrs10490924  0.6243454613 0.112922906  5.52895320 3.221473e-08 1.8670235 1.4963378 2.329539 1000
## 10  CFHrs1410996  CFHrs1410996  0.3154310240 0.128347280  2.45763699 1.398545e-02 1.3708501 1.0659591 1.762947 1000
## 11   C2rs9332739   C2rs9332739  1.0717936770 0.433256076  2.47381107 1.336804e-02 2.9206134 1.2493549 6.827510 1000
## 12   CFBrs641153   CFBrs641153  0.1993582016 0.253688461  0.78583866 4.319620e-01 1.2206191 0.7424038 2.006874 1000
## 13  CFHrs2230199  CFHrs2230199  0.3402726917 0.125293121  2.71581303 6.611324e-03 1.4053308 1.0993320 1.796504 1000
# Or a survial analysis

reg_2<-reg_x(data = diabetes, x = c(3:4, 6), y ="diabetes",time=2,factors = c(1, 3, 4), model = 'coxph')
reg_2
##           x        term    estimate  std.error  statistic     p.value        HR    HR.low   HR.high    N
## 1   smoking   smoking_1  0.17247504 0.15526447  1.1108468 0.266634305 1.1882422 0.8764832 1.6108916  926
## 2 education education_1 -0.06871785 0.15313905 -0.4487285 0.653627559 0.9335901 0.6915188 1.2604001 1000
## 3       BMI         BMI -0.05564539 0.02111973 -2.6347584 0.008419718 0.9458745 0.9075203 0.9858496  994
# adjust some covariates

reg_3<-reg_x(data = diabetes, x = c("sex","age"), y ="diabetes" ,cov=c("CFBrs641153","CFHrs2230199"), factors ="sex", model = 'glm',cov_show = TRUE)
reg_3
##     x         term     estimate   std.error  statistic     p.value        OR    OR.low  OR.high    N
## 2 sex        sex_1 -0.095195435 0.164518306 -0.5786313 0.562838007 0.9091952 0.6585957 1.255149 1000
## 3 sex  CFBrs641153  0.230790886 0.255559041  0.9030825 0.366482136 1.2595958 0.7633065 2.078564 1000
## 4 sex CFHrs2230199  0.342102415 0.125633639  2.7230160 0.006468892 1.4079045 1.1006105 1.800996 1000
## 6 age          age -0.001887778 0.006114376 -0.3087442 0.757516121 0.9981140 0.9862240 1.010147 1000
## 7 age  CFBrs641153  0.224355970 0.255129981  0.8793791 0.379195768 1.2515164 0.7590485 2.063496 1000
## 8 age CFHrs2230199  0.344428164 0.125604894  2.7421556 0.006103742 1.4111827 1.1032354 1.805088 1000
# How about regression on several dependent variables
reg_4<-reg_y(data = diabetes, x = c("sex","age","CFHrs1061170"), y =c("systolic","diastolic","BMI") ,cov=c("CFBrs641153","CFHrs2230199"), factors ="sex", model = 'lm')
reg_4
##           y            x         term    estimate   std.error  statistic      p.value        coef    coef.low   coef.high   N
## 1  systolic          sex        sex_1 -2.69428330 1.177660308 -2.2878272 2.235750e-02 -2.69428330 -5.00527758 -0.38328902 995
## 2  systolic          age          age  0.62409179 0.039210814 15.9163181 5.778111e-51  0.62409179  0.54714603  0.70103755 995
## 3  systolic CFHrs1061170 CFHrs1061170  0.49087994 0.783066116  0.6268691 5.308894e-01  0.49087994 -1.04577821  2.02753809 995
## 4 diastolic          sex        sex_1 -1.73296131 0.708148117 -2.4471735 1.457089e-02 -1.73296131 -3.12260333 -0.34331929 995
## 5 diastolic          age          age  0.15343916 0.025977166  5.9066936 4.793066e-09  0.15343916  0.10246259  0.20441573 995
## 6 diastolic CFHrs1061170 CFHrs1061170 -0.30611928 0.471042899 -0.6498756 5.159232e-01 -0.30611928 -1.23047534  0.61823679 995
## 7       BMI          sex        sex_1 -0.39143773 0.243573523 -1.6070619 1.083597e-01 -0.39143773 -0.86941742  0.08654197 994
## 8       BMI          age          age  0.05159255 0.008939646  5.7712071 1.052213e-08  0.05159255  0.03404972  0.06913538 994
## 9       BMI CFHrs1061170 CFHrs1061170 -0.10033051 0.161718714 -0.6204013 5.351364e-01 -0.10033051 -0.41768134  0.21702033 994
# Cool, but I want to do a subgroup analysis

reg_5<-reg(data = diabetes, x = c("age","CFHrs1061170"), y =c("systolic","diastolic") ,cov=c("CFBrs641153","CFHrs2230199"), model = 'lm',group="sex")
reg_5
## # A tibble: 8 x 12
##     sex         y            x         term   estimate  std.error  statistic      p.value       coef    coef.low coef.high     N
##   <dbl>    <fctr>        <chr>        <chr>      <dbl>      <dbl>      <dbl>        <dbl>      <dbl>       <dbl>     <dbl> <dbl>
## 1     0  systolic          age          age  0.6477326 0.05076473 12.7594992 6.063847e-33  0.6477326  0.54802193 0.7474432   569
## 2     0  systolic CFHrs1061170 CFHrs1061170  1.1440952 1.05733099  1.0820597 2.796876e-01  1.1440952 -0.93268422 3.2208747   569
## 3     0 diastolic          age          age  0.1303477 0.03356128  3.8838704 1.149692e-04  0.1303477  0.06442756 0.1962678   569
## 4     0 diastolic CFHrs1061170 CFHrs1061170  0.2286169 0.62463113  0.3660031 7.144998e-01  0.2286169 -0.99826579 1.4554996   569
## 5     1  systolic          age          age  0.5930679 0.06179047  9.5980472 7.305923e-20  0.5930679  0.47161244 0.7145233   426
## 6     1  systolic CFHrs1061170 CFHrs1061170 -0.4651260 1.15629722 -0.4022547 6.877002e-01 -0.4651260 -2.73794544 1.8076933   426
## 7     1 diastolic          age          age  0.1937122 0.04099307  4.7254861 3.132224e-06  0.1937122  0.11313616 0.2742882   426
## 8     1 diastolic CFHrs1061170 CFHrs1061170 -1.0898894 0.71130615 -1.5322366 1.262133e-01 -1.0898894 -2.48803370 0.3082550   426
# or two subgroup analysis
reg_6<-reg(data = diabetes, x = c("age","CFHrs1061170"), y =c("systolic","diastolic") ,cov=c("CFBrs641153","CFHrs2230199"), model = 'lm',group=c("sex","smoking"))
reg_6
##      group level         y            x         term    estimate  std.error   statistic      p.value        coef    coef.low coef.high   N
## 1      sex     0  systolic          age          age  0.64773257 0.05076473 12.75949920 6.063847e-33  0.64773257  0.54802193 0.7474432 569
## 2      sex     0  systolic CFHrs1061170 CFHrs1061170  1.14409524 1.05733099  1.08205968 2.796876e-01  1.14409524 -0.93268422 3.2208747 569
## 3      sex     0 diastolic          age          age  0.13034768 0.03356128  3.88387043 1.149692e-04  0.13034768  0.06442756 0.1962678 569
## 4      sex     0 diastolic CFHrs1061170 CFHrs1061170  0.22861690 0.62463113  0.36600306 7.144998e-01  0.22861690 -0.99826579 1.4554996 569
## 5      sex     1  systolic          age          age  0.59306788 0.06179047  9.59804724 7.305923e-20  0.59306788  0.47161244 0.7145233 426
## 6      sex     1  systolic CFHrs1061170 CFHrs1061170 -0.46512605 1.15629722 -0.40225475 6.877002e-01 -0.46512605 -2.73794544 1.8076933 426
## 7      sex     1 diastolic          age          age  0.19371219 0.04099307  4.72548612 3.132224e-06  0.19371219  0.11313616 0.2742882 426
## 8      sex     1 diastolic CFHrs1061170 CFHrs1061170 -1.08988936 0.71130615 -1.53223665 1.262133e-01 -1.08988936 -2.48803370 0.3082550 426
## 9  smoking     0  systolic          age          age  0.56709310 0.05775625  9.81873047 9.527853e-21  0.56709310  0.45358764 0.6805986 454
## 10 smoking     0  systolic CFHrs1061170 CFHrs1061170  0.09315881 1.09475817  0.08509533 9.322234e-01  0.09315881 -2.05831432 2.2446319 454
## 11 smoking     0 diastolic          age          age  0.12266643 0.03938756  3.11434456 1.961246e-03  0.12266643  0.04526004 0.2000728 454
## 12 smoking     0 diastolic CFHrs1061170 CFHrs1061170  0.34433728 0.68460209  0.50297434 6.152284e-01  0.34433728 -1.00107674 1.6897513 454
## 13 smoking     1  systolic          age          age  0.70147846 0.05756805 12.18520429 8.091810e-30  0.70147846  0.58835143 0.8146055 467
## 14 smoking     1  systolic CFHrs1061170 CFHrs1061170  0.48555084 1.21375126  0.40004147 6.893105e-01  0.48555084 -1.89959281 2.8706945 467
## 15 smoking     1 diastolic          age          age  0.19687617 0.03742561  5.26046659 2.200772e-07  0.19687617  0.12333107 0.2704213 467
## 16 smoking     1 diastolic CFHrs1061170 CFHrs1061170 -0.97263707 0.70551713 -1.37861582 1.686790e-01 -0.97263707 -2.35904940 0.4137752 467
## 17 smoking    NA  systolic          age          age  0.53068925 0.14994046  3.53933329 7.175890e-04  0.53068925  0.23164244 0.8297361  74
## 18 smoking    NA  systolic CFHrs1061170 CFHrs1061170  2.87081804 2.97945574  0.96353774 3.385946e-01  2.87081804 -3.07151907 8.8131551  74
## 19 smoking    NA diastolic          age          age  0.10466712 0.09433926  1.10947570 2.710221e-01  0.10466712 -0.08348661 0.2928208  74
## 20 smoking    NA diastolic CFHrs1061170 CFHrs1061170 -0.23489246 1.75288157 -0.13400361 8.937842e-01 -0.23489246 -3.73090451 3.2611196  74
# or subgroup combination analysis
reg_7<-reg(data = diabetes, x = c("age","CFHrs1061170"), y =c("systolic","diastolic") ,cov=c("CFBrs641153","CFHrs2230199"), model = 'lm',group=c("sex","smoking"),group_combine = TRUE)
reg_7
## # A tibble: 24 x 13
##      sex smoking         y            x         term    estimate  std.error   statistic      p.value        coef    coef.low  coef.high     N
##    <dbl>   <dbl>    <fctr>        <chr>        <chr>       <dbl>      <dbl>       <dbl>        <dbl>       <dbl>       <dbl>      <dbl> <dbl>
##  1     0       0  systolic          age          age  0.56566186 0.07304951  7.74354045 2.301974e-13  0.56566186  0.42180198  0.7095217   258
##  2     0       0  systolic CFHrs1061170 CFHrs1061170  0.03696846 1.39565115  0.02648833 9.788886e-01  0.03696846 -2.71155369  2.7854906   258
##  3     0       0 diastolic          age          age  0.05249817 0.05145244  1.02032422 3.085456e-01  0.05249817 -0.04882956  0.1538259   258
##  4     0       0 diastolic CFHrs1061170 CFHrs1061170  0.01277514 0.88599675  0.01441894 9.885071e-01  0.01277514 -1.73206039  1.7576107   258
##  5     0       1  systolic          age          age  0.70618780 0.07593126  9.30035608 5.640935e-18  0.70618780  0.55667724  0.8556984   267
##  6     0       1  systolic CFHrs1061170 CFHrs1061170  2.02610247 1.69213826  1.19736225 2.322435e-01  2.02610247 -1.30576002  5.3579650   267
##  7     0       1 diastolic          age          age  0.20585792 0.04809969  4.27981799 2.622268e-05  0.20585792  0.11114843  0.3005674   267
##  8     0       1 diastolic CFHrs1061170 CFHrs1061170  0.42781849 0.96394397  0.44382091 6.575370e-01  0.42781849 -1.47021125  2.3258482   267
##  9     0      NA  systolic          age          age  0.81921451 0.20115008  4.07265312 2.135090e-04  0.81921451  0.41267503  1.2257540    44
## 10     0      NA  systolic CFHrs1061170 CFHrs1061170  2.31536173 4.56061889  0.50768586 6.144618e-01  2.31536173 -6.90199287 11.5327163    44
## 11     0      NA diastolic          age          age  0.12892734 0.12646759  1.01944967 3.141161e-01  0.12892734 -0.12667319  0.3845279    44
## 12     0      NA diastolic CFHrs1061170 CFHrs1061170 -0.17778391 2.44958412 -0.07257718 9.425043e-01 -0.17778391 -5.12857809  4.7730103    44
## 13     1       0  systolic          age          age  0.57996701 0.09378644  6.18391135 3.684510e-09  0.57996701  0.39498297  0.7649511   196
## 14     1       0  systolic CFHrs1061170 CFHrs1061170 -0.11335576 1.77338944 -0.06392040 9.491001e-01 -0.11335576 -3.61118286  3.3844713   196
## 15     1       0 diastolic          age          age  0.22779350 0.06043316  3.76934634 2.177436e-04  0.22779350  0.10859535  0.3469917   196
## 16     1       0 diastolic CFHrs1061170 CFHrs1061170  0.57770379 1.08064396  0.53459216 5.935504e-01  0.57770379 -1.55375456  2.7091621   196
## 17     1       1  systolic          age          age  0.69287978 0.08951395  7.74046694 5.144888e-13  0.69287978  0.51634563  0.8694139   200
## 18     1       1  systolic CFHrs1061170 CFHrs1061170 -1.14297702 1.72236416 -0.66360938 5.077201e-01 -1.14297702 -4.53972238  2.2537684   200
## 19     1       1 diastolic          age          age  0.18182606 0.06063870  2.99851533 3.064515e-03  0.18182606  0.06223799  0.3014141   200
## 20     1       1 diastolic CFHrs1061170 CFHrs1061170 -2.58830102 1.02894363 -2.51549350 1.268953e-02 -2.58830102 -4.61752317 -0.5590789   200
## 21     1      NA  systolic          age          age  0.13268222 0.18812265  0.70529638 4.868970e-01  0.13268222 -0.25400942  0.5193739    30
## 22     1      NA  systolic CFHrs1061170 CFHrs1061170  2.91196013 3.01091415  0.96713489 3.423874e-01  2.91196013 -3.27706254  9.1009828    30
## 23     1      NA diastolic          age          age  0.05955039 0.13652874  0.43617474 6.663104e-01  0.05955039 -0.22108846  0.3401892    30
## 24     1      NA diastolic CFHrs1061170 CFHrs1061170 -0.73920266 2.20642133 -0.33502335 7.402955e-01 -0.73920266 -5.27456666  3.7961613    30

How about plot these regression models

# good idea

plot(reg_1)

# One OR value is larger than others, we can set the limits
plot(reg_1,limits=c(NA,3))

# Sort the variables according to alphabetical

plot(reg_1,limits=c(NA,3), sort ="alphabetical")

# Similarly, we can plot for several dependent variables result

plot(reg_4)
## Some variables are duplicated in your regression result.
## Using cov_show = FALSE for covariate variables or facet for subgroup result.

# Subgroup and several dependent variables result
plot(reg_5)+facet_grid(sex~y)
## Some variables are duplicated in your regression result.
## Using cov_show = FALSE for covariate variables or facet for subgroup result.

# Actually, you can modify the plot like ggplot2 
library(ggplot2);library(ggthemes)

plot(reg_1,limits=c(0.5,2))+
  labs(list(title = "Regression Model", x = "variables"))+
  theme_classic() %+replace% 
  theme(legend.position ="none",axis.text.x=element_text(angle=45,size=rel(1.5)))

Perspective

The quickReg package provides a flexible and convenient way to dispaly data and the association between variables. This vignette offers a glimpse of its use and features. The source code and help files are more helpful. The package is ongoing. If you have any comments, questions or bug reports, please contact me.