getResults: Easily retrieve summary data as R-objects (matrices and...

Description Usage Arguments Value Note See Also Examples

View source: R/getResults.R

Description

This functions excratcs specific results (descriptives, p-values, Odds-Ratios / Hazard-Ratios, ...) from a compareGroups object as matrix or vectors.

Usage

1
getResults(obj, what = "descr")

Arguments

obj

an object of class 'compareGroups' or 'createTable'

what

character indicating which results are to be retrieved: decriptives, p-value, p-trend, pairwise p-values, or Odds-Ratios / Hazard-Ratios. Possible values are: "descr", "p.overall", "p.trend", "p.mul" and "ratio". Default value is "descr".

Value

what = "descr"

An array or matrix with as many columns as variables/categories and seven columns indicating all possible descriptive statistics (mean, sd, median, Q1, Q3, absolute and relative frequencies). When different groups are analysed, the 3rd dimension of the array corresponds to the groups. Otherwise, the result will be a matrix with no 3rd dimension.

what = "p.overall"

A vector whose elevements are the p-value for each analysed variable.

what = "p.trend"

A vector whose elevements are the p-trend for each analysed variable.

what = "p.mul"

A matrix with pairwise p-values where rows correspond to the analysed variables and columns to each pair of groups.

what = "ratio"

A matrix with as many rows as variables/categorieswith and 4 columns corresponding to the OR/HR, confidence interval and p-value.

Note

For descriptives, NA is placed for descriptives not appropiate for the variable. For example columns corresponding to frequencies for continuous variables will be NA.

See Also

compareGroups, createTable

Examples

1
2
3
4
5
6
7
require(compareGroups)
data(regicor)
res<-compareGroups(sex ~ . ,regicor,method=c(triglyc=2))
# retrieve descriptives
getResults(res)
# retrieve OR and their corresponding p-values
getResults(res,what="ratio")

Example output

Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, round.POSIXt, trunc.POSIXt, units

Loading required package: gdata
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to locate valid perl interpreter
gdata: 
gdata: read.xls() will be unable to read Excel XLS and XLSX files
gdata: unless the 'perl=' argument is used to specify the location of a
gdata: valid perl intrpreter.
gdata: 
gdata: (To avoid display of this message in the future, please ensure
gdata: perl is installed and available on the executable search path.)
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLX' (Excel 97-2004) files.

gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLSX' (Excel 2007+) files.

gdata: Run the function 'installXLSXsupport()'
gdata: to automatically download and install the perl
gdata: libaries needed to support Excel XLS and XLSX formats.

Attaching package: 'gdata'

The following object is masked from 'package:Hmisc':

    combine

The following object is masked from 'package:stats':

    nobs

The following object is masked from 'package:utils':

    object.size

The following object is masked from 'package:base':

    startsWith

Loading required package: xtable

Attaching package: 'xtable'

The following objects are masked from 'package:Hmisc':

    label, label<-

Loading required package: SNPassoc
Loading required package: haplo.stats
Loading required package: mvtnorm
Loading required package: parallel
, , [ALL]

                                                         mean           sd med
Individual id                                    1.215818e+09 1.339539e+09  NA
Recruitment year: 1995                                     NA           NA  NA
Recruitment year: 2000                                     NA           NA  NA
Recruitment year: 2005                                     NA           NA  NA
Age                                              5.473627e+01 1.104926e+01  NA
Smoking status: Never smoker                               NA           NA  NA
Smoking status: Current or former < 1y                     NA           NA  NA
Smoking status: Former >= 1y                               NA           NA  NA
Systolic blood pressure                          1.311741e+02 2.030658e+01  NA
Diastolic blood pressure                         7.965877e+01 1.054792e+01  NA
History of hypertension: Yes                               NA           NA  NA
History of hypertension: No                                NA           NA  NA
Hypertension treatment: No                                 NA           NA  NA
Hypertension treatment: Yes                                NA           NA  NA
Total cholesterol                                2.187577e+02 4.524609e+01  NA
HDL cholesterol                                  5.268910e+01 1.474849e+01  NA
Triglycerides                                              NA           NA  97
LDL cholesterol                                  1.432467e+02 3.969013e+01  NA
History of hyperchol.: Yes                                 NA           NA  NA
History of hyperchol.: No                                  NA           NA  NA
Cholesterol treatment: No                                  NA           NA  NA
Cholesterol treatment: Yes                                 NA           NA  NA
Height (cm)                                      1.629156e+02 9.216404e+00  NA
Weight (Kg)                                      7.343586e+01 1.367845e+01  NA
Body mass index                                  2.764126e+01 4.555700e+00  NA
Physical activity (Kcal/week)                    3.988314e+02 3.881642e+02  NA
Physical component                               4.961986e+01 9.009636e+00  NA
Mental component                                 4.798318e+01 1.098306e+01  NA
Cardiovascular event: No                                   NA           NA  NA
Cardiovascular event: Yes                                  NA           NA  NA
Days to cardiovascular event or end of follow-up 1.754668e+03 1.080625e+03  NA
Overall death: No                                          NA           NA  NA
Overall death: Yes                                         NA           NA  NA
Days to overall death or end of follow-up        1.721305e+03 1.051047e+03  NA
                                                 Q1  Q3    n       prop
Individual id                                    NA  NA   NA         NA
Recruitment year: 1995                           NA  NA  431 0.18788143
Recruitment year: 2000                           NA  NA  786 0.34263296
Recruitment year: 2005                           NA  NA 1077 0.46948561
Age                                              NA  NA   NA         NA
Smoking status: Never smoker                     NA  NA 1201 0.53784147
Smoking status: Current or former < 1y           NA  NA  593 0.26556202
Smoking status: Former >= 1y                     NA  NA  439 0.19659651
Systolic blood pressure                          NA  NA   NA         NA
Diastolic blood pressure                         NA  NA   NA         NA
History of hypertension: Yes                     NA  NA  723 0.31627297
History of hypertension: No                      NA  NA 1563 0.68372703
Hypertension treatment: No                       NA  NA 1823 0.80986228
Hypertension treatment: Yes                      NA  NA  428 0.19013772
Total cholesterol                                NA  NA   NA         NA
HDL cholesterol                                  NA  NA   NA         NA
Triglycerides                                    72 136   NA         NA
LDL cholesterol                                  NA  NA   NA         NA
History of hyperchol.: Yes                       NA  NA  709 0.31192257
History of hyperchol.: No                        NA  NA 1564 0.68807743
Cholesterol treatment: No                        NA  NA 2011 0.89816883
Cholesterol treatment: Yes                       NA  NA  228 0.10183117
Height (cm)                                      NA  NA   NA         NA
Weight (Kg)                                      NA  NA   NA         NA
Body mass index                                  NA  NA   NA         NA
Physical activity (Kcal/week)                    NA  NA   NA         NA
Physical component                               NA  NA   NA         NA
Mental component                                 NA  NA   NA         NA
Cardiovascular event: No                         NA  NA 2071 0.95746648
Cardiovascular event: Yes                        NA  NA   92 0.04253352
Days to cardiovascular event or end of follow-up NA  NA   NA         NA
Overall death: No                                NA  NA 1975 0.91945996
Overall death: Yes                               NA  NA  173 0.08054004
Days to overall death or end of follow-up        NA  NA   NA         NA

, , Male

                                                         mean           sd med
Individual id                                    1.249812e+09 1.347204e+09  NA
Recruitment year: 1995                                     NA           NA  NA
Recruitment year: 2000                                     NA           NA  NA
Recruitment year: 2005                                     NA           NA  NA
Age                                              5.478474e+01 1.108709e+01  NA
Smoking status: Never smoker                               NA           NA  NA
Smoking status: Current or former < 1y                     NA           NA  NA
Smoking status: Former >= 1y                               NA           NA  NA
Systolic blood pressure                          1.340373e+02 1.894442e+01  NA
Diastolic blood pressure                         8.165665e+01 1.019543e+01  NA
History of hypertension: Yes                               NA           NA  NA
History of hypertension: No                                NA           NA  NA
Hypertension treatment: No                                 NA           NA  NA
Hypertension treatment: Yes                                NA           NA  NA
Total cholesterol                                2.172795e+02 4.274327e+01  NA
HDL cholesterol                                  4.754918e+01 1.259985e+01  NA
Triglycerides                                              NA           NA 110
LDL cholesterol                                  1.447680e+02 3.854902e+01  NA
History of hyperchol.: Yes                                 NA           NA  NA
History of hyperchol.: No                                  NA           NA  NA
Cholesterol treatment: No                                  NA           NA  NA
Cholesterol treatment: Yes                                 NA           NA  NA
Height (cm)                                      1.692727e+02 7.340116e+00  NA
Weight (Kg)                                      7.971587e+01 1.191404e+01  NA
Body mass index                                  2.781147e+01 3.730815e+00  NA
Physical activity (Kcal/week)                    4.066184e+02 4.248869e+02  NA
Physical component                               5.104962e+01 8.010419e+00  NA
Mental component                                 5.035020e+01 9.906833e+00  NA
Cardiovascular event: No                                   NA           NA  NA
Cardiovascular event: Yes                                  NA           NA  NA
Days to cardiovascular event or end of follow-up 1.744434e+03 1.082418e+03  NA
Overall death: No                                          NA           NA  NA
Overall death: Yes                                         NA           NA  NA
Days to overall death or end of follow-up        1.677167e+03 1.029199e+03  NA
                                                 Q1  Q3   n       prop
Individual id                                    NA  NA  NA         NA
Recruitment year: 1995                           NA  NA 206 0.18710263
Recruitment year: 2000                           NA  NA 390 0.35422343
Recruitment year: 2005                           NA  NA 505 0.45867393
Age                                              NA  NA  NA         NA
Smoking status: Never smoker                     NA  NA 301 0.28104575
Smoking status: Current or former < 1y           NA  NA 410 0.38281979
Smoking status: Former >= 1y                     NA  NA 360 0.33613445
Systolic blood pressure                          NA  NA  NA         NA
Diastolic blood pressure                         NA  NA  NA         NA
History of hypertension: Yes                     NA  NA 341 0.31113139
History of hypertension: No                      NA  NA 755 0.68886861
Hypertension treatment: No                       NA  NA 889 0.82467532
Hypertension treatment: Yes                      NA  NA 189 0.17532468
Total cholesterol                                NA  NA  NA         NA
HDL cholesterol                                  NA  NA  NA         NA
Triglycerides                                    80 147  NA         NA
LDL cholesterol                                  NA  NA  NA         NA
History of hyperchol.: Yes                       NA  NA 353 0.32266910
History of hyperchol.: No                        NA  NA 741 0.67733090
Cholesterol treatment: No                        NA  NA 962 0.89405204
Cholesterol treatment: Yes                       NA  NA 114 0.10594796
Height (cm)                                      NA  NA  NA         NA
Weight (Kg)                                      NA  NA  NA         NA
Body mass index                                  NA  NA  NA         NA
Physical activity (Kcal/week)                    NA  NA  NA         NA
Physical component                               NA  NA  NA         NA
Mental component                                 NA  NA  NA         NA
Cardiovascular event: No                         NA  NA 996 0.95585413
Cardiovascular event: Yes                        NA  NA  46 0.04414587
Days to cardiovascular event or end of follow-up NA  NA  NA         NA
Overall death: No                                NA  NA 943 0.91553398
Overall death: Yes                               NA  NA  87 0.08446602
Days to overall death or end of follow-up        NA  NA  NA         NA

, , Female

                                                         mean           sd  med
Individual id                                    1.184445e+09 1.332220e+09   NA
Recruitment year: 1995                                     NA           NA   NA
Recruitment year: 2000                                     NA           NA   NA
Recruitment year: 2005                                     NA           NA   NA
Age                                              5.469153e+01 1.101869e+01   NA
Smoking status: Never smoker                               NA           NA   NA
Smoking status: Current or former < 1y                     NA           NA   NA
Smoking status: Former >= 1y                               NA           NA   NA
Systolic blood pressure                          1.285144e+02 2.115815e+01   NA
Diastolic blood pressure                         7.780288e+01 1.053501e+01   NA
History of hypertension: Yes                               NA           NA   NA
History of hypertension: No                                NA           NA   NA
Hypertension treatment: No                                 NA           NA   NA
Hypertension treatment: Yes                                NA           NA   NA
Total cholesterol                                2.201255e+02 4.742239e+01   NA
HDL cholesterol                                  5.749380e+01 1.499370e+01   NA
Triglycerides                                              NA           NA 87.5
LDL cholesterol                                  1.418699e+02 4.066348e+01   NA
History of hyperchol.: Yes                                 NA           NA   NA
History of hyperchol.: No                                  NA           NA   NA
Cholesterol treatment: No                                  NA           NA   NA
Cholesterol treatment: Yes                                 NA           NA   NA
Height (cm)                                      1.569882e+02 6.410992e+00   NA
Weight (Kg)                                      6.758024e+01 1.257931e+01   NA
Body mass index                                  2.748256e+01 5.205095e+00   NA
Physical activity (Kcal/week)                    3.916288e+02 3.508277e+02   NA
Physical component                               4.825805e+01 9.676943e+00   NA
Mental component                                 4.572867e+01 1.147720e+01   NA
Cardiovascular event: No                                   NA           NA   NA
Cardiovascular event: Yes                                  NA           NA   NA
Days to cardiovascular event or end of follow-up 1.764180e+03 1.079351e+03   NA
Overall death: No                                          NA           NA   NA
Overall death: Yes                                         NA           NA   NA
Days to overall death or end of follow-up        1.761969e+03 1.069629e+03   NA
                                                 Q1  Q3    n       prop
Individual id                                    NA  NA   NA         NA
Recruitment year: 1995                           NA  NA  225 0.18860017
Recruitment year: 2000                           NA  NA  396 0.33193630
Recruitment year: 2005                           NA  NA  572 0.47946354
Age                                              NA  NA   NA         NA
Smoking status: Never smoker                     NA  NA  900 0.77452668
Smoking status: Current or former < 1y           NA  NA  183 0.15748709
Smoking status: Former >= 1y                     NA  NA   79 0.06798623
Systolic blood pressure                          NA  NA   NA         NA
Diastolic blood pressure                         NA  NA   NA         NA
History of hypertension: Yes                     NA  NA  382 0.32100840
History of hypertension: No                      NA  NA  808 0.67899160
Hypertension treatment: No                       NA  NA  934 0.79624893
Hypertension treatment: Yes                      NA  NA  239 0.20375107
Total cholesterol                                NA  NA   NA         NA
HDL cholesterol                                  NA  NA   NA         NA
Triglycerides                                    66 120   NA         NA
LDL cholesterol                                  NA  NA   NA         NA
History of hyperchol.: Yes                       NA  NA  356 0.30195081
History of hyperchol.: No                        NA  NA  823 0.69804919
Cholesterol treatment: No                        NA  NA 1049 0.90197764
Cholesterol treatment: Yes                       NA  NA  114 0.09802236
Height (cm)                                      NA  NA   NA         NA
Weight (Kg)                                      NA  NA   NA         NA
Body mass index                                  NA  NA   NA         NA
Physical activity (Kcal/week)                    NA  NA   NA         NA
Physical component                               NA  NA   NA         NA
Mental component                                 NA  NA   NA         NA
Cardiovascular event: No                         NA  NA 1075 0.95896521
Cardiovascular event: Yes                        NA  NA   46 0.04103479
Days to cardiovascular event or end of follow-up NA  NA   NA         NA
Overall death: No                                NA  NA 1032 0.92307692
Overall death: Yes                               NA  NA   86 0.07692308
Days to overall death or end of follow-up        NA  NA   NA         NA

                                                         OR   OR.lower
Individual id                                    1.00000000 1.00000000
Recruitment year: 2000                           0.92973770 0.73464737
Recruitment year: 2005                           1.03703804 0.82887136
Age                                              0.99923650 0.99185476
Smoking status: Current or former < 1y           0.14954071 0.12004545
Smoking status: Former >= 1y                     0.07363818 0.05554227
Systolic blood pressure                          0.98645343 0.98235797
Diastolic blood pressure                         0.96469756 0.95679273
History of hypertension: No                      0.95538389 0.80058784
Hypertension treatment: Yes                      1.20334625 0.97404308
Total cholesterol                                1.00139478 0.99953684
HDL cholesterol                                  1.05403395 1.04680956
Triglycerides                                    0.99312696 0.99161403
LDL cholesterol                                  0.99815969 0.99601738
History of hyperchol.: No                        1.10125105 0.92201065
Cholesterol treatment: Yes                       0.91711102 0.69691476
Height (cm)                                      0.76924517 0.75309866
Weight (Kg)                                      0.92237352 0.91477961
Body mass index                                  0.98425663 0.96655383
Physical activity (Kcal/week)                    0.99990038 0.99968462
Physical component                               0.96492588 0.95520350
Mental component                                 0.96013615 0.95193173
Cardiovascular event: Yes                        0.92652448 0.60869018
Days to cardiovascular event or end of follow-up 1.00001692 0.99993885
Overall death: Yes                               0.90334143 0.66129680
Days to overall death or end of follow-up        1.00007689 0.99999620
                                                   OR.upper          pval
Individual id                                    1.00000000  2.428983e-01
Recruitment year: 2000                           1.17621611  5.438095e-01
Recruitment year: 2005                           1.29711990  7.501763e-01
Age                                              1.00667317  8.399987e-01
Smoking status: Current or former < 1y           0.18560560  0.000000e+00
Smoking status: Former >= 1y                     0.09660496  0.000000e+00
Systolic blood pressure                          0.99056597  1.314480e-10
Diastolic blood pressure                         0.97266771  1.114680e-17
History of hypertension: No                      1.13983473  6.124146e-01
Hypertension treatment: Yes                      1.48827608  8.619969e-02
Total cholesterol                                1.00325617  1.412835e-01
HDL cholesterol                                  1.06130820  7.706286e-51
Triglycerides                                    0.99464220  7.552867e-19
LDL cholesterol                                  1.00030660  9.289571e-02
History of hyperchol.: No                        1.31537018  2.872368e-01
Cholesterol treatment: Yes                       1.20689119  5.363264e-01
Height (cm)                                      0.78573786 8.696034e-130
Weight (Kg)                                      0.93003046  8.413354e-82
Body mass index                                  1.00228367  8.659591e-02
Physical activity (Kcal/week)                    1.00011620  3.655988e-01
Physical component                               0.97474721  4.840485e-12
Mental component                                 0.96841128  1.531181e-20
Cardiovascular event: Yes                        1.41038249  7.210919e-01
Days to cardiovascular event or end of follow-up 1.00009500  6.710408e-01
Overall death: Yes                               1.23369266  5.220728e-01
Days to overall death or end of follow-up        1.00015759  6.180690e-02

compareGroups documentation built on Aug. 30, 2017, 5:02 p.m.