tables for data frames

dtable(
  data,
  y = NULL,
  x = NULL,
  ...,
  level = -1,
  response = NULL,
  flat = TRUE,
  total = FALSE,
  prop = FALSE,
  summary = NULL
)

Arguments

data

if x is formula or names for data frame then data frame is needed.

y

name of variable, or fomula, or names of variables on data frame.

x

name of variable, or fomula, or names of variables on data frame.

...

Optional additional arguments

level

1 for all marginal tables, 2 for all 2 by 2 tables, and null for the full table, possible versus group variable

response

For level=2, only produce tables with columns given by 'response' (index)

flat

produce flat tables

total

add total counts/proportions

prop

Proportions instead of counts (vector of margins)

summary

summary function

Author

Klaus K. Holst and Thomas Scheike

Examples

data("sTRACE",package="timereg")

dtable(sTRACE,~status)
#> 
#> status
#>   0   7   9 
#> 236   5 259 
#> 
dtable(sTRACE,~status+vf)
#> 
#>        vf   0   1
#> status           
#> 0         225  11
#> 7           5   0
#> 9         241  18
dtable(sTRACE,~status+vf,level=1)
#> 
#> status
#>   0   7   9 
#> 236   5 259 
#> 
#> vf
#>   0   1 
#> 471  29 
#> 
dtable(sTRACE,~status+vf,~chf+diabetes)
#> chf: 0
#> diabetes: 0
#> 
#>        vf   0   1
#> status           
#> 0         143   4
#> 7           4   0
#> 9          70   2
#> ------------------------------------------------------------ 
#> chf: 1
#> diabetes: 0
#> 
#>        vf   0   1
#> status           
#> 0          66   7
#> 7           1   0
#> 9         141  15
#> ------------------------------------------------------------ 
#> chf: 0
#> diabetes: 1
#> 
#>        vf 0
#> status     
#> 0         8
#> 9         8
#> ------------------------------------------------------------ 
#> chf: 1
#> diabetes: 1
#> 
#>        vf  0  1
#> status         
#> 0          8  0
#> 9         22  1

dtable(sTRACE,c("*f*","status"),~diabetes)
#> diabetes: 0
#> 
#>        status   0   7   9
#> chf vf                   
#> 0   0         143   4  70
#>     1           4   0   2
#> 1   0          66   1 141
#>     1           7   0  15
#> ------------------------------------------------------------ 
#> diabetes: 1
#> 
#>        status  0  9
#> chf vf             
#> 0   0          8  8
#>     1          0  0
#> 1   0          8 22
#>     1          0  1
dtable(sTRACE,c("*f*","status"),~diabetes, level=2)
#> diabetes: 0
#> 
#>    chf
#> vf    0   1
#>   0 217 208
#>   1   6  22
#> 
#>       chf
#> status   0   1
#>      0 147  73
#>      7   4   1
#>      9  72 156
#> 
#>       vf
#> status   0   1
#>      0 209  11
#>      7   5   0
#>      9 211  17
#> 
#> ------------------------------------------------------------ 
#> diabetes: 1
#> 
#>    chf
#> vf   0  1
#>   0 16 30
#>   1  0  1
#> 
#>       chf
#> status  0  1
#>      0  8  8
#>      9  8 23
#> 
#>       vf
#> status  0  1
#>      0 16  0
#>      9 30  1
#> 
dtable(sTRACE,c("*f*","status"),level=1)
#> 
#> chf
#>   0   1 
#> 239 261 
#> 
#> vf
#>   0   1 
#> 471  29 
#> 
#> status
#>   0   7   9 
#> 236   5 259 
#> 

dtable(sTRACE,~"*f*"+status,level=1)
#> 
#> chf
#>   0   1 
#> 239 261 
#> 
#> vf
#>   0   1 
#> 471  29 
#> 
#> status
#>   0   7   9 
#> 236   5 259 
#> 
dtable(sTRACE,~"*f*"+status+I(wmi>1.4)|age>60,level=2)
#> 
#>    chf
#> vf    0   1
#>   0 145 209
#>   1   5  16
#> 
#>       chf
#> status   0   1
#>      0  83  58
#>      7   3   0
#>      9  64 167
#> 
#>             chf
#> I(wmi > 1.4)   0   1
#>        FALSE  57 149
#>        TRUE   93  76
#> 
#>       vf
#> status   0   1
#>      0 135   6
#>      7   3   0
#>      9 216  15
#> 
#>             vf
#> I(wmi > 1.4)   0   1
#>        FALSE 191  15
#>        TRUE  163   6
#> 
#>             status
#> I(wmi > 1.4)   0   7   9
#>        FALSE  53   0 153
#>        TRUE   88   3  78
#> 
dtable(sTRACE,"*f*"+status~I(wmi>0.5)|age>60,level=1)
#> I(wmi > 0.5): FALSE
#> 
#> chf
#> 1 
#> 3 
#> 
#> vf
#> 0 1 
#> 2 1 
#> 
#> status
#> 0 9 
#> 1 2 
#> 
#> ------------------------------------------------------------ 
#> I(wmi > 0.5): TRUE
#> 
#> chf
#>   0   1 
#> 150 222 
#> 
#> vf
#>   0   1 
#> 352  20 
#> 
#> status
#>   0   7   9 
#> 140   3 229 
#> 
dtable(sTRACE,status~dcut(age))
#> dcut(age): [28.1,60]
#> 
#> status
#>  0  7  9 
#> 95  2 28 
#> 
#> ------------------------------------------------------------ 
#> dcut(age): (60,68.7]
#> 
#> status
#>  0  7  9 
#> 66  2 57 
#> 
#> ------------------------------------------------------------ 
#> dcut(age): (68.7,76]
#> 
#> status
#>  0  7  9 
#> 55  1 69 
#> 
#> ------------------------------------------------------------ 
#> dcut(age): (76,92.1]
#> 
#> status
#>   0   9 
#>  20 105 
#> 

dtable(sTRACE,~status+vf+sex|age>60)
#> 
#>           sex   0   1
#> status vf            
#> 0      0       52  83
#>        1        3   3
#> 7      0        0   3
#>        1        0   0
#> 9      0       80 136
#>        1        6   9
dtable(sTRACE,status+vf+sex~+1|age>60, level=2)
#> 
#>    status
#> vf    0   7   9
#>   0 135   3 216
#>   1   6   0  15
#> 
#>    status
#> sex   0   7   9
#>   0  55   0  86
#>   1  86   3 145
#> 
#>    vf
#> sex   0   1
#>   0 132   9
#>   1 222  12
#> 
dtable(sTRACE,.~status+vf+sex|age>60,level=1)
#> status: 0
#> vf: 0
#> sex: 0
#> 
#> no
#>   64  207  295  313  385  386  672  762  775  879  977  979 1171 1483 1599 2457 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 2520 2549 2712 2820 2850 2927 2952 3587 3832 3872 3902 3970 3999 4049 4189 4295 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 4419 4515 4522 4623 4868 4911 4955 5032 5192 5305 5363 5470 5643 5783 5997 6150 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 6231 6258 6309 6549 
#>    1    1    1    1 
#> 
#> wmi
#> 0.8 0.9   1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9   2 
#>   1   2   1   6   2   3   4   4   7   5   9   5   3 
#> 
#> chf
#>  0  1 
#> 30 22 
#> 
#> age
#> 60.422 60.918 61.242  61.42 61.755 61.782 62.182 62.997  63.38 64.354 65.461 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 65.546 67.389  67.77  68.31 68.507 68.663 68.869 69.842 70.059 70.791 70.999 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 71.183 71.227 71.273 71.326 71.411 71.942 72.326 73.829 73.996 74.174 74.193 
#>      1      1      1      1      1      1      1      1      1      1      1 
#>   74.3 74.777 74.986 75.117 75.194 75.597 75.964 76.249 76.551 76.691 76.803 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 77.703 78.004 80.222 80.288 80.529 82.021 82.437 86.163 
#>      1      1      1      1      1      1      1      1 
#> 
#> diabetes
#>  0  1 
#> 50  2 
#> 
#> time
#> 6.124 6.146 6.149 6.151 6.162 6.187 6.272 6.323 6.343 6.406  6.45 6.499 6.505 
#>     1     1     1     1     1     1     1     1     1     1     1     1     1 
#> 6.511 6.521 6.526  6.56 6.601  6.62 6.628 6.631 6.666  6.71 6.721  6.74 6.831 
#>     1     2     1     1     1     1     1     1     1     1     1     1     1 
#> 6.875  6.91 6.943 7.009 7.011 7.063 7.118 7.126 7.261 7.294  7.34 7.346 7.406 
#>     1     1     1     1     1     1     1     1     1     1     1     1     1 
#> 7.422 7.458 7.505 7.562 7.598 7.604 7.619 7.683 7.702 7.743 7.872 8.033 
#>     1     1     1     1     1     1     1     1     1     1     1     1 
#> 
#> ------------------------------------------------------------ 
#> status: 7
#> vf: 0
#> sex: 0
#> NULL
#> ------------------------------------------------------------ 
#> status: 9
#> vf: 0
#> sex: 0
#> 
#> no
#>   27  312  454  476  565  707  728  784  796  808  914  999 1085 1554 1563 1592 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 1611 1620 1654 1748 1973 2239 2255 2386 2570 2729 2867 2902 2938 3035 3039 3127 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 3234 3245 3286 3333 3372 3623 3742 3756 3857 3985 4006 4021 4239 4399 4641 4776 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 4802 4827 4847 4894 4914 4933 5003 5072 5080 5249 5277 5514 5589 5603 5647 5716 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 5740 5764 5857 5866 6044 6045 6054 6180 6193 6268 6311 6317 6523 6542 6564 6628 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 
#> wmi
#> 0.6 0.7 0.8 0.9   1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9   2 2.1 
#>   1   4   8   3   3  12   3   3   7   4   8   8   6   3   6   1 
#> 
#> chf
#>  0  1 
#> 19 61 
#> 
#> age
#> 60.477 63.005 63.057 63.737 64.474 65.382 65.442 65.618 66.393 66.539 66.884 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 67.608 67.964 69.352 69.502 70.207   70.5 71.422 71.671 71.767 71.811 72.628 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 72.839 73.258 73.406 74.048 74.147 74.163 75.347 75.358 75.419 75.666 76.907 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 77.031 77.119 77.297 77.385 77.434 77.914 78.081 78.185 78.221 78.687  78.72 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 78.753 78.827 79.537 79.542 79.997 80.121 80.576 80.888 81.047 81.892   82.3 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 82.626 82.676 82.706 82.961 82.988 83.282 83.405  83.52 83.764 84.269 84.529 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 84.562 84.825 85.141 85.404 85.763 85.867   86.1 86.561 87.175 88.348 88.828 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 88.847 90.673  92.11 
#>      1      1      1 
#> 
#> diabetes
#>  0  1 
#> 68 12 
#> 
#> time
#> 0.00924501924891956  0.0102543342947029  0.0127033231498208  0.0148339297396597 
#>                   1                   1                   1                   1 
#>  0.0244941983071622  0.0291877593353856  0.0449010478444397  0.0491303009549156 
#>                   1                   1                   1                   1 
#>               0.061  0.0812215200138744   0.103132670026505   0.106090152188204 
#>                   1                   1                   1                   1 
#>               0.124               0.135               0.145               0.175 
#>                   1                   1                   1                   1 
#>               0.196   0.217822634588927               0.233               0.381 
#>                   1                   1                   1                   1 
#>                0.48               0.493               0.534   0.551569005857687 
#>                   1                   1                   1                   1 
#>               0.554               0.567               0.642               0.787 
#>                   1                   1                   1                   1 
#>               0.795               0.913               0.959               0.998 
#>                   1                   1                   1                   1 
#>               1.121               1.179                1.25               1.337 
#>                   1                   1                   1                   1 
#>               1.412                1.51               1.603               1.752 
#>                   1                   1                   1                   1 
#>               1.801               1.893               1.968    2.05902000734583 
#>                   1                   1                   1                   1 
#>               2.392    2.47266312449542               2.554               2.773 
#>                   1                   1                   1                   1 
#>               2.795               2.937               3.261    3.39589819746953 
#>                   1                   1                   1                   1 
#>               3.593               3.894               3.943                4.08 
#>                   1                   1                   1                   1 
#>               4.176               4.338               4.559               4.595 
#>                   1                   1                   1                   1 
#>               4.814               4.859               4.883               4.904 
#>                   1                   1                   1                   1 
#>               4.943               5.151               5.359               5.571 
#>                   1                   1                   1                   1 
#>               5.767               5.927               5.954    5.95500826347712 
#>                   1                   1                   1                   1 
#>                6.02               6.108               6.362               6.579 
#>                   1                   1                   1                   1 
#>               6.836               7.222               7.261               7.379 
#>                   1                   1                   1                   1 
#> 
#> ------------------------------------------------------------ 
#> status: 0
#> vf: 1
#> sex: 0
#> 
#> no
#> 1881 3847 5248 
#>    1    1    1 
#> 
#> wmi
#> 1.4 1.6 1.7 
#>   1   1   1 
#> 
#> chf
#> 1 
#> 3 
#> 
#> age
#> 60.688 66.119 78.498 
#>      1      1      1 
#> 
#> diabetes
#> 0 
#> 3 
#> 
#> time
#> 6.031 6.447 6.496 
#>     1     1     1 
#> 
#> ------------------------------------------------------------ 
#> status: 7
#> vf: 1
#> sex: 0
#> NULL
#> ------------------------------------------------------------ 
#> status: 9
#> vf: 1
#> sex: 0
#> 
#> no
#>  965 1787 5378 5481 5841 6487 
#>    1    1    1    1    1    1 
#> 
#> wmi
#> 0.7   1 1.2 1.3 1.5 
#>   1   1   2   1   1 
#> 
#> chf
#> 0 1 
#> 1 5 
#> 
#> age
#> 62.912  64.31 70.846 73.352 75.646  77.28 
#>      1      1      1      1      1      1 
#> 
#> diabetes
#> 0 1 
#> 5 1 
#> 
#> time
#> 0.00723927922639996  0.0130957318809815  0.0159947743292432               0.044 
#>                   1                   1                   1                   1 
#>               0.302               0.411 
#>                   1                   1 
#> 
#> ------------------------------------------------------------ 
#> status: 0
#> vf: 0
#> sex: 1
#> 
#> no
#>   22   23   25  137  236  244  366  369  384  427  473  636  680  774  804  899 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#>  929 1052 1062 1246 1285 1306 1328 1354 1466 1519 1694 1749 1993 2172 2228 2230 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 2263 2297 2311 2358 2382 2411 2458 2550 2889 2897 3137 3323 3350 3384 3460 3522 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 3585 3650 3661 4280 4468 4516 4711 4723 4855 4936 5173 5234 5434 5478 5479 5519 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 5565 5619 5664 5709 5750 5766 5851 5896 5906 6049 6075 6153 6175 6195 6254 6414 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 6436 6525 6553 
#>    1    1    1 
#> 
#> wmi
#> 0.4 0.6 0.7 0.8 0.9   1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9   2 2.2 
#>   1   3   1   2   1   3   7   4   5   5   3   9  13  11   3  11   1 
#> 
#> chf
#>  0  1 
#> 50 33 
#> 
#> age
#> 60.047 60.208 60.302 60.803  60.96 61.036 61.491 61.897 61.919 62.319 62.492 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 62.827  62.84 62.912 62.928 63.287 63.298 63.885 63.893 64.005 64.186 64.329 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 64.373 64.606 65.368 65.428 65.746 65.798 65.878 66.064 66.459  67.06 67.194 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 67.367 67.597 67.655 67.701 67.885 68.003 68.151 68.154 68.211 68.318 68.324 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 68.345 68.913 69.036 69.236 69.343 69.933 70.182 70.314 70.654   70.7 70.917 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 71.046  71.32 71.811 72.195 72.595 72.759 72.869 73.141 73.195 73.236  74.07 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 74.404 74.437 74.618 74.816 74.988 75.027 75.068 75.191 75.358 75.663 77.025 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 77.171 78.511  79.09 79.578  81.67   83.4 
#>      1      1      1      1      1      1 
#> 
#> diabetes
#>  0  1 
#> 79  4 
#> 
#> time
#> 5.998 6.003 6.004 6.034 6.069 6.077  6.11 6.151 6.156 6.162 6.219  6.28 6.283 
#>     1     1     1     1     1     1     1     1     1     1     1     1     1 
#> 6.302 6.316 6.346 6.348 6.359 6.384 6.392 6.401 6.433 6.436 6.463 6.467 6.496 
#>     1     1     1     1     1     1     1     1     2     1     1     1     1 
#> 6.502 6.554 6.592 6.601 6.611 6.658  6.71 6.732 6.768 6.773 6.776 6.795 6.803 
#>     1     1     1     1     1     1     1     1     1     1     1     1     1 
#> 6.823 6.836 6.847 6.979 6.992 7.028 7.074 7.091 7.096 7.102 7.209 7.217 7.239 
#>     1     1     1     1     1     1     2     1     1     1     1     1     2 
#> 7.261 7.302 7.326 7.335 7.345 7.352 7.364 7.493 7.494 7.571 7.579 7.625 7.652 
#>     1     1     1     1     1     1     1     1     2     1     1     1     1 
#> 7.746 7.809 7.811 7.817 7.828 7.861 7.863 7.897  7.97 7.976 8.011 8.099 8.157 
#>     1     1     1     1     1     1     2     1     1     1     1     1     1 
#> 
#> ------------------------------------------------------------ 
#> status: 7
#> vf: 0
#> sex: 1
#> 
#> no
#>  792 4441 6242 
#>    1    1    1 
#> 
#> wmi
#> 1.7 1.9 
#>   2   1 
#> 
#> chf
#> 0 
#> 3 
#> 
#> age
#> 63.241 66.089 73.645 
#>      1      1      1 
#> 
#> diabetes
#> 0 
#> 3 
#> 
#> time
#>  0.02 0.028 
#>     2     1 
#> 
#> ------------------------------------------------------------ 
#> status: 9
#> vf: 0
#> sex: 1
#> 
#> no
#>   48  125  181  219  235  267  275  277  335  436  477  483  489  506  509  535 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#>  649  656  695  727  921  969  983 1029 1044 1064 1077 1089 1116 1157 1166 1173 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 1214 1225 1260 1280 1301 1337 1456 1490 1615 1671 1703 1723 1739 1757 1813 1924 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 1933 1939 1944 1946 2041 2210 2320 2345 2349 2585 2648 2672 2703 2907 2971 3025 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 3045 3093 3103 3214 3242 3256 3301 3320 3349 3373 3414 3428 3517 3541 3544 3552 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 3627 3647 3685 3793 3809 3946 4018 4051 4143 4228 4247 4369 4417 4479 4511 4524 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 4532 4538 4621 4687 4727 4777 4784 4786 4996 5009 5073 5106 5177 5201 5232 5279 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 5281 5318 5412 5438 5449 5459 5475 5587 5721 5723 5868 5977 5985 6011 6057 6121 
#>    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1    1 
#> 6297 6377 6476 6482 6502 6605 6639 6645 
#>    1    1    1    1    1    1    1    1 
#> 
#> wmi
#> 0.4 0.6 0.7 0.8 0.9   1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9   2 2.7 
#>   1   6   8   6  10  13  16  15  14   7   8   6   6  10   4   5   1 
#> 
#> chf
#>  0  1 
#> 43 93 
#> 
#> age
#> 60.258 60.573 60.592 60.628 61.291 61.823 62.191 62.437 62.478 62.541 64.036 
#>      1      1      1      1      1      1      1      1      1      2      1 
#> 64.074  64.17 64.403 64.562 64.685 64.847 65.242 65.379 65.439 65.459 65.461 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 65.681 66.023 66.909 67.265 67.271 67.293 67.323 67.389 67.581 67.644 67.668 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 67.753     68 68.025 68.345 68.568 68.691 68.902 68.943 69.121 69.204   69.7 
#>      2      1      1      1      1      1      1      1      1      1      1 
#> 70.026 70.032 70.073 70.075 70.081 70.319 70.402 71.687 71.827 72.049  72.74 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 72.762 72.847 72.886 73.086 73.099 73.453 73.508 73.714 74.177 74.377 74.615 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 74.829 74.843 74.873 74.999 75.134 75.224 75.263 75.284 75.306 75.408 75.485 
#>      1      1      1      1      1      1      1      1      1      1      1 
#>  75.55 75.594 75.652 76.016 76.101 76.164 76.189 76.247 76.255 76.258 76.376 
#>      1      1      1      1      2      1      1      1      1      1      1 
#> 76.817 77.001 77.047 77.272 77.395 77.574 77.829 77.947 78.045 78.169 78.256 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 78.385  78.41 78.476 78.563 78.613 78.769 78.923 79.024 79.197 79.602 79.611 
#>      1      1      1      1      1      1      1      1      1      1      1 
#>  79.66 80.713 80.913 81.034 82.169 82.396 82.654 82.939 83.375 83.422 83.542 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 83.781 84.255  84.34 84.661 84.839 84.924 85.683 85.988  86.72 87.682 89.746 
#>      1      1      1      1      1      1      1      1      1      1      1 
#> 91.515 
#>      1 
#> 
#> diabetes
#>   0   1 
#> 118  18 
#> 
#> time
#>          0.00068749 0.00479720664164051               0.005  0.0147687892620452 
#>                   1                   1                   1                   1 
#>  0.0148054198783357  0.0150148906719405  0.0155063371912111  0.0157959215559531 
#>                   1                   1                   1                   1 
#>               0.019  0.0234311041657347  0.0246992394567933  0.0294018010152504 
#>                   1                   1                   1                   1 
#>  0.0320110500110313  0.0335205551215913   0.033717549782712   0.043362094122218 
#>                   1                   1                   1                   1 
#>  0.0455668172480073               0.048  0.0513728010684717  0.0569486366831698 
#>                   1                   1                   1                   1 
#>               0.064               0.066               0.096   0.103118983768858 
#>                   1                   1                   1                   1 
#>               0.115               0.121                0.14                0.16 
#>                   1                   1                   1                   1 
#>               0.171               0.189               0.206               0.211 
#>                   1                   1                   1                   1 
#>               0.215                0.25               0.255               0.311 
#>                   1                   1                   1                   1 
#>   0.339372734833974               0.398               0.403               0.415 
#>                   1                   1                   1                   1 
#>               0.474               0.538               0.674               0.743 
#>                   1                   1                   1                   1 
#>               0.773               0.801               0.858               0.968 
#>                   1                   1                   1                   1 
#>               0.984               1.055                1.06               1.085 
#>                   1                   1                   1                   1 
#>               1.091               1.132               1.157               1.173 
#>                   1                   1                   1                   1 
#>               1.264                1.28               1.327               1.334 
#>                   1                   1                   1                   1 
#>               1.338               1.345               1.354                1.37 
#>                   1                   1                   1                   1 
#>               1.467               1.475               1.505                1.65 
#>                   1                   1                   1                   1 
#>               1.809               1.839    1.85956658420642               1.912 
#>                   1                   1                   1                   1 
#>               1.946               2.088               2.099    2.17698150922544 
#>                   1                   1                   1                   1 
#>               2.209               2.214               2.225               2.249 
#>                   1                   1                   1                   1 
#>               2.266               2.293               2.296               2.327 
#>                   1                   1                   1                   1 
#>                2.42               2.423               2.661               2.694 
#>                   1                   1                   1                   1 
#>               2.735               2.801               2.875               2.902 
#>                   1                   1                   1                   1 
#>               2.932               2.971               3.001               3.006 
#>                   1                   1                   1                   1 
#>               3.025               3.069    3.07071981293638               3.162 
#>                   1                   1                   1                   1 
#>               3.168               3.282                3.65               3.855 
#>                   1                   1                   1                   1 
#>               3.976               4.143    4.20126902716421               4.332 
#>                   1                   1                   1                   1 
#>    4.53260631947941               4.557               4.694               4.732 
#>                   1                   1                   1                   1 
#>               4.737               4.778               4.803               4.828 
#>                   1                   1                   1                   1 
#>               5.014               5.094               5.102               5.247 
#>                   1                   1                   1                   1 
#>               5.351               5.441               5.691               5.727 
#>                   1                   1                   1                   1 
#>                5.82               5.943               6.086               6.132 
#>                   1                   1                   1                   1 
#>               6.206               6.414               6.496               6.521 
#>                   1                   1                   1                   1 
#>               6.641               6.672               6.809               6.877 
#>                   1                   1                   1                   1 
#> 
#> ------------------------------------------------------------ 
#> status: 0
#> vf: 1
#> sex: 1
#> 
#> no
#> 1983 5559 5751 
#>    1    1    1 
#> 
#> wmi
#> 1.4 1.6 1.7 
#>   1   1   1 
#> 
#> chf
#> 0 
#> 3 
#> 
#> age
#> 62.722 67.339 70.435 
#>      1      1      1 
#> 
#> diabetes
#> 0 
#> 3 
#> 
#> time
#> 7.751 7.828 7.924 
#>     1     1     1 
#> 
#> ------------------------------------------------------------ 
#> status: 7
#> vf: 1
#> sex: 1
#> NULL
#> ------------------------------------------------------------ 
#> status: 9
#> vf: 1
#> sex: 1
#> 
#> no
#> 1207 1245 1296 2677 2890 3018 4082 6376 6416 
#>    1    1    1    1    1    1    1    1    1 
#> 
#> wmi
#> 0.4 0.7 0.8   1 1.3 1.4 1.9 
#>   1   2   1   2   1   1   1 
#> 
#> chf
#> 0 1 
#> 1 8 
#> 
#> age
#> 61.431 64.123 68.666 70.303 71.929 72.392 73.491 77.173 81.883 
#>      1      1      1      1      1      1      1      1      1 
#> 
#> diabetes
#> 0 
#> 9 
#> 
#> time
#> 0.0131395697484259 0.0200790603328496 0.0269757455710787 0.0466610295798164 
#>                  1                  1                  1                  1 
#> 0.0473181052301079  0.086709953642916  0.245226208094042              1.765 
#>                  1                  1                  1                  1 
#>              1.773 
#>                  1 
#> 
dtable(sTRACE,status+vf+sex~diabetes|age>60)
#> diabetes: 0
#> 
#>           sex   0   1
#> status vf            
#> 0      0       50  79
#>        1        3   3
#> 7      0        0   3
#>        1        0   0
#> 9      0       68 118
#>        1        5   9
#> ------------------------------------------------------------ 
#> diabetes: 1
#> 
#>           sex  0  1
#> status vf          
#> 0      0       2  4
#>        1       0  0
#> 9      0      12 18
#>        1       1  0
dtable(sTRACE,status+vf+sex~diabetes|age>60, flat=FALSE)
#> diabetes: 0
#> 
#> , , sex = 0
#> 
#>       vf
#> status   0   1
#>      0  50   3
#>      7   0   0
#>      9  68   5
#> 
#> , , sex = 1
#> 
#>       vf
#> status   0   1
#>      0  79   3
#>      7   3   0
#>      9 118   9
#> 
#> ------------------------------------------------------------ 
#> diabetes: 1
#> 
#> , , sex = 0
#> 
#>       vf
#> status  0  1
#>      0  2  0
#>      9 12  1
#> 
#> , , sex = 1
#> 
#>       vf
#> status  0  1
#>      0  4  0
#>      9 18  0
#> 

dtable(sTRACE,status+vf+sex~diabetes|age>60, level=1)
#> diabetes: 0
#> 
#> status
#>   0   7   9 
#> 135   3 200 
#> 
#> vf
#>   0   1 
#> 318  20 
#> 
#> sex
#>   0   1 
#> 126 212 
#> 
#> ------------------------------------------------------------ 
#> diabetes: 1
#> 
#> status
#>  0  9 
#>  6 31 
#> 
#> vf
#>  0  1 
#> 36  1 
#> 
#> sex
#>  0  1 
#> 15 22 
#> 
dtable(sTRACE,status+vf+sex~diabetes|age>60, level=2)
#> diabetes: 0
#> 
#>    status
#> vf    0   7   9
#>   0 129   3 186
#>   1   6   0  14
#> 
#>    status
#> sex   0   7   9
#>   0  53   0  73
#>   1  82   3 127
#> 
#>    vf
#> sex   0   1
#>   0 118   8
#>   1 200  12
#> 
#> ------------------------------------------------------------ 
#> diabetes: 1
#> 
#>    status
#> vf   0  9
#>   0  6 30
#>   1  0  1
#> 
#>    status
#> sex  0  9
#>   0  2 13
#>   1  4 18
#> 
#>    vf
#> sex  0  1
#>   0 14  1
#>   1 22  0
#> 

dtable(sTRACE,status+vf+sex~diabetes|age>60, level=2, prop=1, total=TRUE)
#> diabetes: 0
#> 
#>    status
#> vf            0           7           9         Sum
#>   0 0.405660377 0.009433962 0.584905660 1.000000000
#>   1 0.300000000 0.000000000 0.700000000 1.000000000
#> 
#>    status
#> sex          0          7          9        Sum
#>   0 0.42063492 0.00000000 0.57936508 1.00000000
#>   1 0.38679245 0.01415094 0.59905660 1.00000000
#> 
#>    vf
#> sex          0          1        Sum
#>   0 0.93650794 0.06349206 1.00000000
#>   1 0.94339623 0.05660377 1.00000000
#> 
#> ------------------------------------------------------------ 
#> diabetes: 1
#> 
#>    status
#> vf          0         9       Sum
#>   0 0.1666667 0.8333333 1.0000000
#>   1 0.0000000 1.0000000 1.0000000
#> 
#>    status
#> sex         0         9       Sum
#>   0 0.1333333 0.8666667 1.0000000
#>   1 0.1818182 0.8181818 1.0000000
#> 
#>    vf
#> sex          0          1        Sum
#>   0 0.93333333 0.06666667 1.00000000
#>   1 1.00000000 0.00000000 1.00000000
#> 
dtable(sTRACE,status+vf+sex~diabetes|age>60, level=2, prop=2, total=TRUE)
#> diabetes: 0
#> 
#>      status
#> vf             0          7          9
#>   0   0.95555556 1.00000000 0.93000000
#>   1   0.04444444 0.00000000 0.07000000
#>   Sum 1.00000000 1.00000000 1.00000000
#> 
#>      status
#> sex           0         7         9
#>   0   0.3925926 0.0000000 0.3650000
#>   1   0.6074074 1.0000000 0.6350000
#>   Sum 1.0000000 1.0000000 1.0000000
#> 
#>      vf
#> sex           0         1
#>   0   0.3710692 0.4000000
#>   1   0.6289308 0.6000000
#>   Sum 1.0000000 1.0000000
#> 
#> ------------------------------------------------------------ 
#> diabetes: 1
#> 
#>      status
#> vf             0          9
#>   0   1.00000000 0.96774194
#>   1   0.00000000 0.03225806
#>   Sum 1.00000000 1.00000000
#> 
#>      status
#> sex           0         9
#>   0   0.3333333 0.4193548
#>   1   0.6666667 0.5806452
#>   Sum 1.0000000 1.0000000
#> 
#>      vf
#> sex           0         1
#>   0   0.3888889 1.0000000
#>   1   0.6111111 0.0000000
#>   Sum 1.0000000 1.0000000
#> 
dtable(sTRACE,status+vf+sex~diabetes|age>60, level=2, prop=1:2, summary=summary)
#> diabetes: 0
#> 
#>    status
#> vf           0          7          9
#>   0 0.38165680 0.00887574 0.55029586
#>   1 0.01775148 0.00000000 0.04142012
#> Number of cases in table: 1 
#> Number of factors: 2 
#> Test for independence of all factors:
#> 	Chisq = 0.003361, df = 2, p-value = 0.9983
#> 	Chi-squared approximation may be incorrect
#> 
#>    status
#> sex          0          7          9
#>   0 0.15680473 0.00000000 0.21597633
#>   1 0.24260355 0.00887574 0.37573964
#> Number of cases in table: 1 
#> Number of factors: 2 
#> Test for independence of all factors:
#> 	Chisq = 0.006099, df = 2, p-value = 0.997
#> 	Chi-squared approximation may be incorrect
#> 
#>    vf
#> sex          0          1
#>   0 0.34911243 0.02366864
#>   1 0.59171598 0.03550296
#> Number of cases in table: 1 
#> Number of factors: 2 
#> Test for independence of all factors:
#> 	Chisq = 0.00019928, df = 1, p-value = 0.9887
#> 	Chi-squared approximation may be incorrect
#> 
#> ------------------------------------------------------------ 
#> diabetes: 1
#> 
#>    status
#> vf           0          9
#>   0 0.16216216 0.81081081
#>   1 0.00000000 0.02702703
#> Number of cases in table: 1 
#> Number of factors: 2 
#> Test for independence of all factors:
#> 	Chisq = 0.005376, df = 1, p-value = 0.9415
#> 	Chi-squared approximation may be incorrect
#> 
#>    status
#> sex          0          9
#>   0 0.05405405 0.35135135
#>   1 0.10810811 0.48648649
#> Number of cases in table: 1 
#> Number of factors: 2 
#> Test for independence of all factors:
#> 	Chisq = 0.004171, df = 1, p-value = 0.9485
#> 	Chi-squared approximation may be incorrect
#> 
#>    vf
#> sex          0          1
#>   0 0.37837838 0.02702703
#>   1 0.59459459 0.00000000
#> Number of cases in table: 1 
#> Number of factors: 2 
#> Test for independence of all factors:
#> 	Chisq = 0.04074, df = 1, p-value = 0.84
#> 	Chi-squared approximation may be incorrect
#>