import web file from haven package

url_stem <- "https://raw.githubusercontent.com/higgi13425/rmrwr-book/master/"

haven::read_sas(glue(url_stem, "data/blood_storage.sas7bdat"))
## # A tibble: 316 × 20
##    rbc_age_group median_rbc_age   age    aa fam_hx p_vol t_vol t_stage  b_gs
##            <dbl>          <dbl> <dbl> <dbl>  <dbl> <dbl> <dbl>   <dbl> <dbl>
##  1             3             25  72.1     0      0  54       3       1     3
##  2             3             25  73.6     0      0  43.2     3       2     2
##  3             3             25  67.5     0      0 103.      1       1     3
##  4             2             15  65.8     0      0  46       1       1     1
##  5             2             15  63.2     0      0  60       2       1     2
##  6             3             25  65.4     0      0  45.9     2       1     1
##  7             3             25  65.5     1      0  42.6     2       1     1
##  8             1             10  67.1     0      0  40.7     3       1     1
##  9             1             10  63.9     0      0  45       2       1     1
## 10             2             15  63       1      0  67.6     2       1     2
## # ℹ 306 more rows
## # ℹ 11 more variables: bn <dbl>, organ_confined <dbl>, preop_psa <dbl>,
## #   preop_therapy <dbl>, units <dbl>, s_gs <dbl>, any_adj_therapy <dbl>,
## #   adj_rad_therapy <dbl>, recurrence <dbl>, censor <dbl>,
## #   time_to_recurrence <dbl>
#haven::read_dta(glue(url_stem, "data/blood_storage.dta"))
#haven::read_sav(glue(url_stem, "data/strep_tb.sav"))

identifying file type through rio package

rio::import(glue(url_stem, "data/blood_storage.sas7bdat"))
##     rbc_age_group median_rbc_age  age aa fam_hx p_vol t_vol t_stage b_gs bn
## 1               3             25 72.1  0      0  54.0     3       1    3  0
## 2               3             25 73.6  0      0  43.2     3       2    2  0
## 3               3             25 67.5  0      0 102.7     1       1    3  0
## 4               2             15 65.8  0      0  46.0     1       1    1  0
## 5               2             15 63.2  0      0  60.0     2       1    2  0
## 6               3             25 65.4  0      0  45.9     2       1    1  0
## 7               3             25 65.5  1      0  42.6     2       1    1  0
## 8               1             10 67.1  0      0  40.7     3       1    1  0
## 9               1             10 63.9  0      0  45.0     2       1    1  0
## 10              2             15 63.0  1      0  67.6     2       1    2  0
## 11              2             15 59.0  0      0  47.2     1       1    2  0
## 12              1             10 58.5  0      0  37.5     3       1    1  0
## 13              1             10 56.2  0      0  51.0     2       1    1  0
## 14              1             10 73.3  0      0  38.6     2       2    2  0
## 15              3             25 59.7  1      0  54.0     2       1    2  0
## 16              1             10 67.6  0      0  41.0     2       1    2  0
## 17              1             10 61.6  0      0  77.0     1      NA    1  0
## 18              1             10 61.2  1      0  76.0     2       1    1  0
## 19              2             15 59.7  1      0  63.0     2       1    2  0
## 20              2             15 65.2  0      0 113.0     2       1    1  0
## 21              2             15 67.1  0      0  54.2     3       1    2  0
## 22              2             15 64.4  0      0  42.0     2       1    2  0
## 23              3             25 61.5  1      0  29.3     2       1    1  0
## 24              2             15 57.9  0      1  24.0     2      NA    1  0
## 25              1             10 69.7  0      0  92.3     1       1    2  0
## 26              3             25 40.5  0      0  29.5     1       1    1  0
## 27              3             25 69.8  0      0  47.5     2       1    1  0
## 28              2             15 68.3  0      0  48.0     2       1    1  0
## 29              3             25 67.9  0      1  61.0     3       2    3  1
## 30              1             10 56.4  0      0  70.8     2       1    2  0
## 31              3             25 69.0  1      0  65.0     2       1    2  0
## 32              3             25 62.1  1      0  36.8     2       1    3  0
## 33              3             25 49.8  1      0  51.7     3       1    1  0
## 34              2             15 73.9  1      0  58.0     2       1    1  0
## 35              3             25 64.2  0      0  66.0     2       1    1  0
## 36              2             15 71.2  0      0  63.0     1       1    1  0
## 37              3             25 60.3  0      0  69.0     1       1    1  0
## 38              2             15 58.6  0      0  43.4     1       1    1  0
## 39              2             15 71.7  0      1  38.5     2       1    3  0
## 40              1             10 69.7  0      1  46.0     2       1    2  0
## 41              3             25 60.0  0      0  38.2     2       2    2  0
## 42              3             25 71.5  0      0  56.0     2       1    1  0
## 43              2             15 43.6  0      0  35.0     2       1    1  0
## 44              3             25 61.9  0      0  52.3     2       1    1  0
## 45              3             25 61.5  0      1    NA     2       1    2  0
## 46              2             15 63.4  1      0  47.9     3       1    3  0
## 47              1             10 70.4  1      0  73.0     3       1    2  0
## 48              3             25 67.4  0      0  66.5     2       1    1  0
## 49              2             15 62.4  1      0  74.0     1       1    1  0
## 50              2             15 69.4  0      0  57.2     3       1    1  0
## 51              1             10 65.3  1      0  43.0    NA       1    1  0
## 52              1             10 59.9  0      0  64.1     1       1    3  0
## 53              1             10 61.8  0      0  63.0     2       1    1  0
## 54              3             25 58.9  0      1 237.0     1       1    1  0
## 55              1             10 67.2  0      0  70.0     1      NA    1  0
## 56              2             15 74.6  0      0  90.2     1      NA    1  0
## 57              2             15 65.0  0      0  78.9     3       1    1  0
## 58              1             10 56.2  0      0  68.0     1       1    3  0
## 59              3             25 57.0  0      1  89.0     3       1    1  0
## 60              3             25 60.4  0      0  40.0     3       1    2  0
## 61              2             15 68.7  1      0  96.0     1       1    1  0
## 62              1             10 60.8  0      0  39.8     3       1    1  0
## 63              1             10 56.8  0      1  31.3     2       1    2  0
## 64              2             15 63.6  0      0  68.0     3       1    1  0
## 65              3             25 60.0  0      0  46.0     2       1    1  0
## 66              3             25 64.4  0      1  60.1     1       1    2  0
## 67              3             25 54.9  0      0  37.5     1       1    2  0
## 68              2             15 47.0  0      1  48.0     2       1    1  0
## 69              1             10 63.6  1      0  44.0     1       1    1  0
## 70              3             25 55.3  0      1  34.0     3       1    1  0
## 71              1             10 74.2  0      1  32.0     2       1    1  0
## 72              3             25 56.0  0      0  34.0     2       1    1  0
## 73              1             10 72.1  0      1 115.0     2       1    2  0
## 74              3             25 71.8  0      1  99.8     2       1    1  0
## 75              3             25 64.7  0      0 104.6     2       1    1  0
## 76              1             10 68.0  1      1  53.0     2       1    1  0
## 77              1             10 66.1  0      0  51.2    NA       1    1  1
## 78              2             15 59.0  1      0  66.0     2       1    1  0
## 79              3             25 61.8  0      0  44.0     1       1    1  0
## 80              1             10 52.8  1      0  43.8     2       1    1  0
## 81              1             10 57.5  1      0  43.0     3       1    2  1
## 82              2             15 74.4  0      0  42.0     3       1    1  0
## 83              3             25 49.6  0      0  67.5     1       1    1  0
## 84              3             25 68.7  0      0  35.0     1       1    3  0
## 85              1             10 47.9  1      0  45.0     2       1    1  1
## 86              2             15 63.7  1      0  43.0     2       1    1  0
## 87              2             15 60.0  0      1  46.2     2       1    1  0
## 88              2             15 61.7  0      0  42.0    NA       1    1  0
## 89              2             15 70.3  0      0  60.8     2       1    1  0
## 90              3             25 55.8  0      0  49.0     2       1    1  0
## 91              1             10 70.2  0      0  64.0     2       1    2  0
## 92              1             10 68.1  0      0  47.7     2       2    3  0
## 93              3             25 69.8  0      0  35.1     3       2    3  1
## 94              1             10 57.1  1      0  36.7     2       1    1  0
## 95              2             15 65.2  0      0    NA     1       1    1  0
## 96              2             15 60.8  0      0  49.0     1       1    1  0
## 97              1             10 49.9  0      0  52.2     3       1    2  0
## 98              1             10 55.2  0      0  82.3     1       1    1  0
## 99              2             15 57.6  0      0  57.5     2       1    1  0
## 100             2             15 57.4  0      0    NA     2       1    1  0
## 101             2             15 59.2  0      0  24.8     3       1    2  0
## 102             1             10 59.9  0      0  48.0     1       1    1  0
## 103             3             25 56.3  0      0 201.5     1      NA    1  0
## 104             3             25 70.6  0      0 102.0     2       1    1  0
## 105             1             10 71.8  0      0  90.1     2       1    1  0
## 106             1             10 58.2  1      0  35.1     2       1    1  0
## 107             2             15 78.3  0      0 135.0     1       1    1  0
## 108             3             25 55.9  0      1  47.1     1       1    1  0
## 109             1             10 53.9  0      0  42.0     2       1    2  0
## 110             1             10 51.7  0      0  43.2     2       1    1  0
## 111             3             25 64.2  0      0  39.0     1       1    1  0
## 112             1             10 67.4  0      0  65.7     2       1    2  0
## 113             1             10 62.3  0      0  52.1     1       1    1  0
## 114             1             10 62.4  0      0  46.0     2       1    1  0
## 115             2             15 71.0  0      0    NA     1       1    1  0
## 116             1             10 60.4  1      0  67.0     3       2    2  0
## 117             2             15 65.9  0      0  63.0     2       1    1  0
## 118             2             15 58.8  0      1  52.0     2       1    3  0
## 119             3             25 63.2  0      0  56.6     2       1    1  0
## 120             3             25 61.1  0      0  65.0     3       1    1  0
## 121             3             25 51.1  0      0  58.0     3       2    3  0
## 122             2             15 57.9  0      0  63.4     2       1    1  0
## 123             2             15 63.4  0      0  60.4     3       1    2  0
## 124             3             25 67.7  0      0  42.1     2       1    2  0
## 125             2             15 58.2  0      0  50.6     1       1    1  0
## 126             2             15 62.1  0      0  59.0     2       1    2  0
## 127             1             10 55.6  0      0  56.0     3       1    2  0
## 128             2             15 64.5  0      0  60.0     2       1    1  0
## 129             2             15 52.8  0      0  64.0     2       1    1  0
## 130             1             10 55.8  0      0  47.0     2       1    1  0
## 131             2             15 68.9  0      0  29.0     3       2    2  0
## 132             2             15 63.5  0      1  42.0     3       1    1  0
## 133             3             25 68.0  0      1  67.0     2       1    2  0
## 134             2             15 64.9  0      0  66.4     2       1    1  0
## 135             1             10 62.7  0      0  33.0     2       1    2  0
## 136             3             25 57.5  0      1  51.0     2       1    1  0
## 137             3             25 70.7  0      0  43.4     3       1    2  0
## 138             3             25 61.7  0      0 105.0     2       1    1  0
## 139             3             25 64.2  0      0  37.5     3       1    2  0
## 140             1             10 69.8  0      1  56.0     3       2    2  0
## 141             3             25 68.0  0      0  96.3     1       1    1  0
## 142             2             15 63.1  0      0  48.0     1       1    2  0
## 143             2             15 64.1  0      0  57.6     2       1    3  0
## 144             3             25 58.1  0      0  36.6     2       1    2  0
## 145             3             25 60.1  0      0    NA     2       1    1  0
## 146             3             25 56.0  0      1  68.0     1       1    1  0
## 147             1             10 62.3  0      1 113.0     1       1    1  0
## 148             1             10 51.2  0      1  51.0     1       1    1  0
## 149             2             15 57.0  0      1  41.0     3       1    2  0
## 150             3             25 51.0  1      0  40.1     2       1    1  1
## 151             3             25 65.8  0      0  99.0     3       1    2  0
## 152             3             25 54.5  0      1  53.6     2       1    1  0
## 153             1             10 55.9  0      0  20.9     3       1    2  0
## 154             3             25 55.7  0      0  48.5     2       1    1  0
## 155             1             10 48.4  0      1  37.0     2       1    1  0
## 156             1             10 58.2  0      0  37.0     3       1    2  0
## 157             1             10 63.9  1      0 108.2     3       1    1  0
## 158             1             10 66.2  0      0  75.0     2       1    1  0
## 159             2             15 62.9  0      0  38.0     3       1    1  0
## 160             2             15 69.1  0      0  41.0     2       1    1  0
## 161             2             15 67.7  0      0  72.8     3       1    3  0
## 162             1             10 55.4  0      0  73.0     2       1    1  0
## 163             3             25 55.6  0      1  50.7     1       1    2  0
## 164             3             25 54.6  0      0  40.0     2       1    1  0
## 165             2             15 64.4  0      0  89.0     2       1    1  0
## 166             1             10 69.7  0      0  75.6     2       1    1  0
## 167             3             25 50.3  0      0  19.4     3       2    2  1
## 168             2             15 57.1  0      0  46.0     2       1    2  0
## 169             1             10 64.2  0      0  37.0     3       2    2  1
## 170             3             25 66.9  0      1  36.1     3       1    1  0
## 171             3             25 71.8  1      0  53.9     2       1    2  0
## 172             2             15 63.9  0      0  65.0     3       1    1  0
## 173             1             10 53.1  0      1  34.0     3       2    2  1
## 174             1             10 62.4  1      1  82.0     2       2    2  0
## 175             1             10 64.9  0      0  78.7     2       1    1  0
## 176             2             15 62.4  0      0  95.0     1       1    1  0
## 177             1             10 58.8  1      0  67.0     3       2    3  0
## 178             3             25 54.4  1      0  35.0     1       1    1  0
## 179             1             10 57.0  0      0  41.2     1       1    1  0
## 180             1             10 65.6  0      1  37.6     2       1    1  0
## 181             1             10 65.9  0      0  51.6     3       1    2  0
## 182             3             25 67.1  0      0  37.0     2       1    2  0
## 183             1             10 62.2  0      0  58.0     2       1    1  0
## 184             2             15 50.6  0      1  31.3     2       1    1  0
## 185             1             10 68.4  0      0  64.0     2       1    1  1
## 186             2             15 55.8  1      0  46.7     3       1    1  0
## 187             1             10 79.0  0      0  72.0     2       1    1  0
## 188             3             25 63.9  0      0  56.0     3       2    2  0
## 189             3             25 49.6  0      0  32.0     2       1    1  0
## 190             1             10 54.9  1      0  31.6     2       1    1  0
## 191             1             10 61.1  0      0  55.0     2       1    1  0
## 192             1             10 59.6  0      0  28.0     2       2    2  0
## 193             3             25 64.7  0      0  38.0     1       1    1  0
## 194             3             25 60.1  0      0  42.0     3       2    2  1
## 195             3             25 64.2  0      0  60.0     2       1    1  0
## 196             2             15 67.6  0      0  67.0     1       1    1  0
## 197             1             10 51.0  0      0  28.0     2       1    1  1
## 198             2             15 58.1  0      0  33.0     2       1    1  0
## 199             1             10 49.0  0      0  28.9     3       1    1  0
## 200             2             15 50.8  0      0  37.0     3       2    2  0
## 201             3             25 55.9  1      1  35.9     1       1    1  0
## 202             3             25 62.3  0      0  57.2     2       1    1  0
## 203             3             25 49.0  0      0  47.8     1       1    1  0
## 204             1             10 59.2  0      1  34.3     3       2    2  0
## 205             3             25 65.7  0      0  39.2     3       1    1  0
## 206             2             15 57.1  0      0  34.0     2       1    2  0
## 207             2             15 62.7  0      0  63.0     1       1    1  0
## 208             2             15 68.6  0      1  62.5     2       1    2  0
## 209             1             10 65.0  1      0  60.6     3       1    3  0
## 210             1             10 66.1  0      0 260.0     3       1    2  0
## 211             1             10 64.7  0      0  27.0     2       1    1  0
## 212             2             15 62.2  0      0    NA     2       1    1  0
## 213             2             15 55.9  0      1  53.4     2       1    1  0
## 214             2             15 45.7  0      0  42.0     2       1    1  0
## 215             1             10 71.4  0      0 164.0     1       1    2  0
## 216             1             10 55.4  0      0  35.8     2       1    1  0
## 217             2             15 54.8  0      0  34.1     2       1    2  0
## 218             2             15 56.1  0      0 111.0     3       2    3  1
## 219             1             10 67.5  0      1  53.1     2       1    1  0
## 220             3             25 58.2  1      0  85.9     1       1    1  0
## 221             3             25 65.3  0      1  42.0     2       1    2  0
## 222             2             15 56.2  0      0  51.0     3       1    2  0
## 223             1             10 66.8  0      0  62.0     1       1    1  0
## 224             2             15 61.5  1      0  37.9     2      NA    2  0
## 225             2             15 55.5  1      1  43.8     3       1    2  1
## 226             3             25 43.8  0      1  33.9     2       1    1  0
## 227             2             15 48.9  0      1  39.6     1       1    1  0
## 228             2             15 68.3  0      0  41.7     2       1    2  0
## 229             3             25 60.5  0      0  49.8     2       1    1  0
## 230             2             15 68.5  0      0  34.1     2       1    1  0
## 231             3             25 46.7  1      0  42.5     3       1    2  0
## 232             1             10 70.8  0      0  44.0     2       1    1  0
## 233             2             15 72.7  0      1  78.1     2       1    1  0
## 234             3             25 47.0  0      0  43.0     3       1    1  0
## 235             3             25 64.4  0      0  49.9     3       2    2  0
## 236             1             10 69.3  0      0  53.0     3       1    2  0
## 237             1             10 51.8  0      0  32.3     3       1    1  0
## 238             1             10 60.4  0      0  34.6     2       1    1  0
## 239             3             25 67.5  1      1  31.9     2       1    1  0
## 240             3             25 63.6  1      1  71.4     3       1    1  0
## 241             3             25 64.3  0      0  50.1     2       1    2  0
## 242             3             25 42.5  0      0  32.0     3       1    3  0
## 243             1             10 56.3  0      0  73.0     1       1    1  0
## 244             1             10 65.7  0      0  49.0     2       1    1  0
## 245             2             15 58.9  0      0  31.2     3       1    2  0
## 246             2             15 43.4  0      0  42.7     3       2    3  1
## 247             2             15 50.9  0      0  43.5     3       2    2  0
## 248             1             10 58.2  0      1 121.0     2       1    1  0
## 249             2             15 74.8  0      1 149.6     2       1    1  0
## 250             1             10 71.9  0      0 274.0     1       1    3  0
## 251             2             15 61.1  0      1    NA     2       1    2  0
## 252             2             15 76.3  0      0    NA    NA      NA   NA  0
## 253             1             10 53.5  0      0  55.0     3       2    2  0
## 254             3             25 43.8  0      1  32.5     2       1    1  0
## 255             1             10 49.9  0      1  42.0     3       1    2  0
## 256             3             25 60.5  0      0  43.0     2       1    1  0
## 257             3             25 45.2  0      1  37.1     2       1    1  0
## 258             3             25 58.3  0      0  27.0     3       1    1  0
## 259             3             25 58.5  0      1  68.0     1       1    3  0
## 260             2             15 57.6  0      1  62.0     1       1    1  0
## 261             3             25 62.3  0      0  68.0     2       1    2  0
## 262             2             15 55.7  0      0  43.9     3       1    2  0
## 263             2             15 62.7  0      1  54.0     3       1    1  0
## 264             1             10 64.4  0      1  48.0     2       2    2  0
## 265             3             25 76.9  0      0    NA     1       2    1  0
## 266             2             15 55.4  0      0  64.8     2       1    1  0
## 267             1             10 47.7  1      1  41.9     2       1    2  0
## 268             3             25 49.1  0      0  63.0     2       1    1  0
## 269             2             15 53.2  0      0  28.0     3       1    1  0
## 270             1             10 54.8  0      1  44.5     3       1    1  0
## 271             2             15 62.2  0      0  43.4     1       1    1  0
## 272             1             10 46.5  0      0  48.2     2       1    2  0
## 273             3             25 62.4  0      0  26.5     2      NA    1  0
## 274             1             10 63.3  0      0  43.0     3       1    2  0
## 275             1             10 67.8  0      0  37.6     3       2    2  0
## 276             3             25 64.8  0      0  67.0     2       1    2  0
## 277             1             10 51.2  0      1  39.0     2       2    3  0
## 278             1             10 62.6  0      1  77.0     1       1    1  0
## 279             1             10 66.7  0      0  58.2     2      NA    1  0
## 280             2             15 63.5  0      0  67.2     3      NA    1  0
## 281             1             10 57.2  0      0  46.9     3       1    3  0
## 282             2             15 59.0  0      0  60.0     1       1    1  0
## 283             1             10 74.9  0      0  55.1     3       1    2  0
## 284             3             25 59.0  0      1  21.2     1       1    1  0
## 285             3             25 56.5  0      0  73.0     3       2    3  0
## 286             3             25 62.7  0      1  46.2     3       2    3  0
## 287             2             15 53.0  1      0  47.0     3       1    2  1
## 288             1             10 58.5  0      1  42.0     3       1    2  0
## 289             3             25 54.5  1      0  47.4     3       1    3  0
## 290             2             15 67.1  0      0  53.0     1       1    1  0
## 291             3             25 38.4  0      1  31.2     3       1    1  0
## 292             3             25 68.2  0      1  63.1     2       1    1  0
## 293             2             15 59.6  1      0  45.4     3       1    1  1
## 294             2             15 60.8  0      0  44.9     3       2    3  0
## 295             1             10 54.2  0      0  43.0     3       1    2  0
## 296             1             10 60.8  0      1  90.7    NA       1    1  0
## 297             1             10 72.8  0      0  43.8     2       2    3  0
## 298             3             25 64.8  0      0  44.3     2       1    2  0
## 299             2             15 51.9  0      0  68.3     3       2    3  1
## 300             2             15 55.1  0      0  50.1     3       1    3  0
## 301             3             25 52.9  0      1  29.9     2      NA    1  0
## 302             1             10 66.5  0      0  51.8     3       1    2  0
## 303             3             25 66.1  0      0  32.2     2       1    3  0
## 304             2             15 55.3  1      0  68.8    NA       1    1  0
## 305             2             15 55.7  1      0  75.8     2      NA    1  0
## 306             2             15 66.9  1      0  56.6     2       1    1  0
## 307             3             25 64.9  1      0  41.3     2       1    1  0
## 308             3             25 70.6  1      0  42.5     1       1    2  0
## 309             2             15 65.1  1      0  61.5     2       1    1  0
## 310             2             15 61.6  1      0  57.2     1       1   NA  0
## 311             1             10 64.1  1      0  62.0     3       1    1  0
## 312             1             10 54.8  0      0  25.6     2       1    1  0
## 313             3             25 62.3  1      0  42.3     2       1    1  0
## 314             3             25 62.4  1      0  50.0     2      NA    1  0
## 315             2             15 57.6  0      0  74.9     1       1    1  0
## 316             3             25 59.9  0      1  54.1     3       1    1  0
##     organ_confined preop_psa preop_therapy units s_gs any_adj_therapy
## 1                0     14.08             1     6    1               0
## 2                1     10.50             0     2    3               0
## 3                1      6.98             1     1    1               0
## 4                1      4.40             0     2    3               0
## 5                1     21.40             0     3    3               0
## 6                0      5.10             0     1    3               0
## 7                1      6.03             0     2    3               0
## 8                0      8.70             0     4    3               0
## 9                1      3.83             0     1    3               0
## 10               1      7.98             0     2    3               0
## 11               1      4.50             0     2    3               0
## 12               1      5.30             0     2    3               0
## 13               1      2.70             0     2    2               0
## 14               0     30.60             1     4    1               0
## 15               1     10.40             0     2    3               0
## 16               1      5.60             1     4    1               0
## 17               1      4.30             0     5    2               0
## 18               1      7.00             0     4    2               0
## 19               1      4.20             0     2    2               0
## 20               1      8.48             0     1    2               0
## 21               0      5.30             0     4    4               0
## 22               0      5.40             1     2    1               0
## 23               1      4.10             0     2    2               0
## 24               1      5.00             0     2    3               0
## 25               1      5.70             0     2    2               0
## 26               1      1.48             0     2    3               0
## 27               1      6.70             0     2    3               0
## 28               0      2.90             0     1    3               0
## 29               0     29.00             1     4    1               1
## 30               1      6.90             0     3    3               0
## 31               1      7.20             0     5    3               0
## 32               0      5.58             0     2    4               0
## 33               1      6.38             0     1    3               0
## 34               1      8.10             0     2    4               0
## 35               1      5.50             0     2    3               0
## 36               1      5.30             0     4    3               0
## 37               1      5.70             0     2    3               0
## 38               1      5.40             0     1    2               0
## 39               1      9.05             0     2    3               0
## 40               0      4.90             0     8    3               0
## 41               0      5.00             0     1    3               0
## 42               1      2.09             0     2    3               0
## 43               1      5.50             0     2    2               0
## 44               0      4.10             0    19    3               0
## 45               1      4.10             0     1    3               0
## 46               0     15.70             1     2    1               0
## 47               0      6.20             0     3    3               0
## 48               1      5.20             0     1    3               0
## 49               1      6.27             0     3    2               0
## 50               1      5.00             0     1    3               0
## 51               0     14.90             0     9    2               0
## 52               0      4.40             1     4    1               0
## 53               0      5.20             0     7    3               0
## 54               1      9.00             0     5    2               0
## 55               1      5.92             0     2    2               0
## 56               1      4.30             0     1    2               0
## 57               1     15.70             0     2    2               0
## 58               1      5.20             0     2    3               0
## 59               0     14.00             0     1    3               0
## 60               1      8.99             0     1    3               0
## 61               1      4.20             0     2    3               0
## 62               0     13.50             0     3    3               0
## 63               0      4.70             0     2    3               0
## 64               1      5.10             0     2    3               0
## 65               1      6.80             0     2    2               0
## 66               1      5.87             0     2    3               0
## 67               1      7.40             0     2    2               0
## 68               1      5.80             0     3    3               0
## 69               1      5.30             0     3    3               0
## 70               1      4.70             0     2    3               0
## 71               1      4.70             0     2    2               0
## 72               1      6.50             0     4    2               0
## 73               1     10.10             0     4    4               0
## 74               1      5.40             0     1    2               0
## 75               0     13.70             0     2    3               0
## 76               0     20.70             0     2    3               0
## 77               1      5.90             0     6    3               0
## 78               1      8.70             0     2    3               0
## 79               1      6.30             0     2    2               0
## 80               1      4.20             0     2    3               0
## 81               0     15.90             0     2    3               1
## 82               0      4.30             0     2    4               0
## 83               1      5.85             0    10    2               0
## 84               1      5.70             1     2    1               0
## 85               1      6.00             1     2    1               0
## 86               0      4.70             0     2    3               0
## 87               0      5.90             0     2    3               0
## 88               1      3.50             0     1    2               0
## 89               1      6.30             1     2    1               0
## 90               0     10.00             0     2    3               0
## 91               0      6.10             0     2    3               0
## 92               0      4.17             1     1    1               0
## 93               0      6.20             1     1    1               1
## 94               1     10.00             0     2    3               0
## 95               1      4.10             0     2    2               0
## 96               1      4.90             0     2    2               0
## 97               1     29.70             0     4    3               0
## 98               1      4.10             1     6    1               0
## 99               1      7.70             0     2    3               0
## 100              1      4.02             0     2    3               0
## 101              0      5.00             1     2    1               0
## 102              1      4.20             0     2    2               0
## 103              1      9.32             0    13    2               0
## 104              1     11.90             0     2    3               0
## 105              0      8.30             0     2    3               0
## 106              1      4.60             0     2    2               0
## 107              1      9.00             0     3    2               0
## 108              1      7.20             0     1    2               0
## 109              1      4.90             0     2    3               0
## 110              1      7.00             0     4    3               0
## 111              1        NA             0     2    2               0
## 112              0      5.00             0     2    3               0
## 113              1      7.60             0     2    3               0
## 114              1      5.40             0     2    3               0
## 115              1      6.30             0     2    3               0
## 116              0      6.30             0     1    3               0
## 117              1      6.80             0     4    2               0
## 118              1     15.60             0     2    4               0
## 119              1      4.70             0     1    2               0
## 120              0     14.20             0     2    3               0
## 121              0     24.90             0     1    4               0
## 122              1      4.89             0     4    3               0
## 123              0      9.10             0     2    3               0
## 124              1      6.18             0     2    3               0
## 125              1      4.20             0     4    2               0
## 126              1      8.20             0     2    3               0
## 127              0     11.90             0     2    3               0
## 128              1      1.80             0     4    2               0
## 129              1      5.80             0     1    2               0
## 130              1      8.90             0     4    2               0
## 131              1     27.00             1     2    1               0
## 132              0      5.60             0     2    3               0
## 133              1     13.20             0     2    3               0
## 134              1     19.70             1     1    1               0
## 135              1      8.90             0     1    3               0
## 136              1      3.90             0     1    3               0
## 137              0      5.70             0     2    3               0
## 138              1      5.20             0     1    2               0
## 139              1      9.90             0     2    3               0
## 140              0      4.65             0     2    3               0
## 141              1      6.20             0     1    3               0
## 142              1      6.70             0     1    2               0
## 143              1      7.00             1     2    1               0
## 144              1      5.00             0     4    3               0
## 145              1      4.96             0     3    3               0
## 146              1      8.30             0     5    2               0
## 147              1      5.40             0     3    2               0
## 148              1      4.40             0     2    3               0
## 149              1      6.60             0     2    3               0
## 150              1      5.10             1     2    1               0
## 151              0     22.90             0     2    3               0
## 152              1      9.75             0     2    3               0
## 153              0      5.10             1     2    1               0
## 154              1      5.60             0     1    2               0
## 155              0      6.60             0     2    2               0
## 156              1      4.99             0     2    4               0
## 157              1     18.00             0     4    3               0
## 158              1      5.00             0     1    2               0
## 159              0      6.20             0     2    3               0
## 160              1      7.80             0     2    3               0
## 161              0     14.40             0     6    4               0
## 162              1      2.90             0     5    3               0
## 163              1      4.00             0     2    3               0
## 164              1      4.40             0     2    3               0
## 165              0      6.30             0     1    2               0
## 166              0      6.80             0     2    3               0
## 167              0     19.60             1     2    1               0
## 168              0      4.10             0     1    3               0
## 169              0      3.70             1     1    1               0
## 170              0      2.50             1     1    1               0
## 171              1     11.90             0     2    3               0
## 172              1      6.30             0     2    3               0
## 173              1      4.80             0     2    3               0
## 174              0      5.60             0     2    3               0
## 175              0      5.30             0     2    3               0
## 176              1     13.60             0     1    2               0
## 177              0      8.20             0     1    3               0
## 178              1      5.10             1     1    1               0
## 179              1      5.10             0     2    3               0
## 180              0      5.20             0     2    2               0
## 181              0      8.10             0     2    3               0
## 182              1      7.10             0     2    3               0
## 183              1      3.88             0     2    3               0
## 184              1     11.06             0     2    3               0
## 185              1      8.40             0     2    3               0
## 186              1      5.80             0     1    3               0
## 187              0      8.10             0     2    3               0
## 188              0     10.07             0     2    4               0
## 189              1      5.30             0     1    2               0
## 190              0     15.00             0     2    3               0
## 191              1      5.60             0     2    2               0
## 192              0      7.90             1     1    1               0
## 193              1      5.40             0    14    3               0
## 194              0     22.30             1     1    1               1
## 195              1      5.70             0     2    2               0
## 196              1      6.80             0     1    2               0
## 197              1      2.80             0     1    2               0
## 198              1      6.80             0     2    3               0
## 199              1      8.10             0     6    3               0
## 200              0     37.00             1     4    1               0
## 201              1      4.70             0     1    3               0
## 202              1      6.40             0     4    2               0
## 203              1      6.60             0     1    2               0
## 204              0      4.20             0     1    3               1
## 205              0      2.10             0     2    3               0
## 206              1     11.80             0     1    3               0
## 207              1      6.80             0     5    2               0
## 208              0      5.86             0     3    3               0
## 209              1     11.09             0     2    3               0
## 210              0     26.10             0     2    3               0
## 211              1      4.90             0     2    3               0
## 212              1      5.00             0     4    2               0
## 213              1      9.20             0     3    2               0
## 214              0      6.70             0     2    3               0
## 215              1     14.90             0     2    2               0
## 216              1      4.70             0     2    3               0
## 217              1     11.40             0     5    3               0
## 218              0      8.30             0     2    4               0
## 219              1      6.00             0     2    3               0
## 220              1     14.20             0     2    2               0
## 221              1      9.40             0     2    3               0
## 222              0      5.00             0     2    3               0
## 223              1      5.30             1     4    1               0
## 224              1      6.90             0     1    3               0
## 225              0     13.00             0     2    3               0
## 226              0      5.20             0     1    3               0
## 227              1      6.20             0     4    2               0
## 228              0      6.75             0     3    3               0
## 229              1      8.20             0     1    3               0
## 230              0      5.50             0     2    3               0
## 231              1     14.93             1     1    1               0
## 232              1      4.20             0     2    3               0
## 233              0      5.30             0     2    3               0
## 234              1      8.00             0     2    2               0
## 235              0     10.80             0     1    3               0
## 236              0      7.10             0     2    3               0
## 237              1      5.10             0     2    3               0
## 238              1      2.81             0     3    3               0
## 239              1      7.00             0     3    3               0
## 240              0      7.00             0     2    3               0
## 241              0      4.60             0     2    3               0
## 242              0     14.70             1     2    1               1
## 243              1      6.20             0     1    2               0
## 244              1      2.20             0     2    3               0
## 245              0      4.20             0     2    4               0
## 246              0      6.88             1     2    1               0
## 247              0     26.20             1     4    1               0
## 248              1     20.00             0     3    2               0
## 249              1     10.10             0     2    2               0
## 250              1     27.74             0     4    2               0
## 251              1      6.40             0     2    3               0
## 252              0        NA             0     3    3               0
## 253              0     13.30             0     2    3               0
## 254              0      9.70             0     2    3               0
## 255              1      4.39             1     2    1               0
## 256              1      4.22             0     2    2               0
## 257              1      5.84             0     1    3               0
## 258              1     13.00             0     2    3               0
## 259              1      5.30             0     5    3               0
## 260              1      9.45             0     2    2               0
## 261              0     12.20             0     1    3               0
## 262              0     10.10             0     2    3               0
## 263              1      4.90             0     2    3               0
## 264              0      4.10             0     1    3               0
## 265              1      3.37             0     6    2               0
## 266              1      5.20             0     4    3               0
## 267              1      3.00             0    10    3               0
## 268              1      3.10             0     1    2               0
## 269              0      4.70             0     2    3               0
## 270              1      6.80             0     2    3               0
## 271              1      5.80             0     2    2               0
## 272              1      4.72             0     2    2               0
## 273              1      4.30             0     2    2               0
## 274              0      4.98             0     2    3               0
## 275              0      4.60             0     1    3               0
## 276              0      9.25             0     1    3               0
## 277              1      5.49             1     2    1               0
## 278              1      3.92             0     4    2               0
## 279              1      6.30             0     2    3               0
## 280              0      7.40             0     6    3               0
## 281              0     12.00             1     2    1               0
## 282              1      4.50             0     2    2               0
## 283              1      6.02             0     3    3               0
## 284              1      1.30             0     2    2               0
## 285              0     40.10             0     3    4               0
## 286              0      3.72             0     2    4               0
## 287              0     39.00             1     2    1               0
## 288              0     10.70             0     2    4               0
## 289              0      6.80             0     2    4               0
## 290              1      6.10             0     1    2               0
## 291              1     12.57             0     2    3               0
## 292              1      4.17             0     2    3               0
## 293              1     30.96             0     2    3               0
## 294              0      4.30             0     2    4               0
## 295              0      8.00             0     2    3               0
## 296              1      7.90             0     2    2               0
## 297              0      5.90             0     2    4               0
## 298              1      2.70             1     4    1               0
## 299              0     27.15             0     2    4               0
## 300              0      8.40             0     2    4               1
## 301              1      4.63             0     4    2               0
## 302              0      6.74             0     1    3               0
## 303              1      7.50             0     2    4               0
## 304              1     11.00             0     2    2               0
## 305              1      6.70             0     1    2               0
## 306              0      7.50             0     2    2               0
## 307              1     11.00             0     6    2               0
## 308              1     17.00             0     1    3               0
## 309              0     14.00             0     2    2               0
## 310              1        NA             1     4    1               0
## 311              1      8.40             0     2    3               0
## 312              1      5.00             0     1    3               0
## 313              1      7.60             0     1    2               0
## 314              0      9.30             0     2    3               0
## 315              1      4.50             0     2    2               0
## 316              1      6.80             0     1    3               0
##     adj_rad_therapy recurrence censor time_to_recurrence
## 1                 0          1      0               2.67
## 2                 0          1      0              47.63
## 3                 0          0      1              14.10
## 4                 0          0      1              59.47
## 5                 0          0      1               1.23
## 6                 0          0      1              74.70
## 7                 0          0      1              13.87
## 8                 0          1      0               8.37
## 9                 0          0      1              48.59
## 10                0          0      1              22.63
## 11                0          0      1               4.63
## 12                0          0      1              46.47
## 13                0          0      1              91.15
## 14                0          0      1              10.77
## 15                0          0      1               5.09
## 16                0          0      1              83.87
## 17                0          0      1               8.30
## 18                0          0      1              71.57
## 19                0          0      1              89.36
## 20                0          0      1              29.30
## 21                0          0      1              83.83
## 22                0          1      0              47.60
## 23                0          0      1              90.55
## 24                0          0      1               7.49
## 25                0          0      1              58.63
## 26                0          0      1              21.13
## 27                0          0      1              41.59
## 28                0          0      1               1.13
## 29                0          0      1              41.00
## 30                0          0      1              47.30
## 31                0          1      0              46.22
## 32                0          0      1              19.83
## 33                0          0      1              38.68
## 34                0          0      1              55.49
## 35                0          0      1             102.20
## 36                0          0      1              37.13
## 37                0          0      1              65.69
## 38                0          0      1              52.07
## 39                0          0      1              46.85
## 40                0          0      1               4.10
## 41                0          0      1               1.07
## 42                0          0      1               5.43
## 43                0          0      1              41.60
## 44                0          0      1               1.97
## 45                0          0      1               9.67
## 46                0          1      0               7.13
## 47                0          1      0               9.77
## 48                0          0      1              47.92
## 49                0          0      1              13.90
## 50                0          0      1              33.83
## 51                0          1      0              10.93
## 52                0          0      1               1.90
## 53                0          0      1              69.07
## 54                0          0      1              90.77
## 55                0          0      1              14.82
## 56                0          0      1              17.20
## 57                0          0      1              80.20
## 58                0          0      1              67.87
## 59                0          0      1              94.10
## 60                0          0      1               3.83
## 61                0          0      1              15.67
## 62                0          1      0              35.37
## 63                0          0      1               7.57
## 64                0          0      1              45.87
## 65                0          0      1              16.13
## 66                0          0      1              41.09
## 67                0          0      1              63.97
## 68                0          0      1               6.52
## 69                0          0      1              10.83
## 70                0          0      1              47.00
## 71                0          0      1              13.80
## 72                0          0      1              63.67
## 73                0          1      0              14.87
## 74                0          0      1              93.80
## 75                0          0      1             101.77
## 76                0          0      1              80.73
## 77                0          1      0              48.33
## 78                0          0      1              71.56
## 79                0          0      1              76.33
## 80                0          0      1              71.50
## 81                0          0      1              13.03
## 82                0          0      1               5.20
## 83                0          0      1              35.39
## 84                0          0      1               1.67
## 85                0          1      0               5.77
## 86                0          0      1               0.40
## 87                0          0      1              58.57
## 88                0          0      1              38.47
## 89                0          0      1              44.17
## 90                0          0      1              73.50
## 91                0          1      0               1.70
## 92                0          0      1               2.40
## 93                0          1      0              44.73
## 94                0          0      1              28.90
## 95                0          0      1              74.27
## 96                0          0      1               3.37
## 97                0          0      1              73.90
## 98                0          0      1              48.33
## 99                0          0      1              29.53
## 100               0          0      1              12.49
## 101               0          1      0              18.40
## 102               0          0      1              86.47
## 103               0          0      1              23.73
## 104               0          0      1              82.43
## 105               0          0      1              83.02
## 106               0          1      0               1.67
## 107               0          1      0               4.23
## 108               0          0      1              23.17
## 109               0          0      1              12.23
## 110               0          0      1              49.07
## 111               0          0      1              66.69
## 112               0          0      1              99.47
## 113               0          0      1              42.62
## 114               0          0      1              86.70
## 115               0          0      1              11.57
## 116               0          0      1              95.25
## 117               0          0      1              63.52
## 118               0          1      0              13.30
## 119               0          0      1              13.77
## 120               0          0      1              10.47
## 121               0          1      0               1.43
## 122               0          0      1              22.26
## 123               0          0      1              70.90
## 124               0          0      1              14.23
## 125               0          0      1              17.03
## 126               0          0      1              20.30
## 127               0          0      1             101.70
## 128               0          0      1             103.60
## 129               0          0      1              24.27
## 130               0          0      1              79.37
## 131               0          1      0              43.77
## 132               0          1      0               1.77
## 133               0          0      1              25.30
## 134               0          0      1              57.83
## 135               0          0      1              68.57
## 136               0          0      1              58.73
## 137               0          0      1              88.25
## 138               0          0      1              41.57
## 139               0          0      1              86.79
## 140               0          0      1              11.20
## 141               0          0      1              67.76
## 142               0          0      1              83.07
## 143               0          0      1              39.37
## 144               0          0      1               9.82
## 145               0          0      1               1.30
## 146               0          0      1              65.00
## 147               0          0      1              95.73
## 148               0          0      1              84.87
## 149               0          0      1              91.39
## 150               0          0      1              37.03
## 151               0          0      1              54.27
## 152               0          0      1               1.27
## 153               0          1      0              24.60
## 154               0          0      1              54.00
## 155               0          0      1              53.07
## 156               0          0      1               5.03
## 157               0          0      1               1.50
## 158               0          0      1              37.97
## 159               0          0      1              91.07
## 160               0          0      1              98.60
## 161               0          1      0               1.47
## 162               0          0      1              59.37
## 163               0          0      1               3.93
## 164               0          1      0              68.07
## 165               0          0      1              64.55
## 166               0          0      1              15.37
## 167               0          1      0              26.70
## 168               0          0      1              81.63
## 169               0          0      1              33.80
## 170               0          0      1              74.50
## 171               0          1      0              30.70
## 172               0          0      1              14.00
## 173               0          0      1              57.23
## 174               0          0      1               0.27
## 175               0          0      1              51.43
## 176               0          0      1              70.13
## 177               0          1      0              12.60
## 178               0          0      1              64.92
## 179               0          0      1              39.03
## 180               0          0      1              33.47
## 181               0          0      1              68.63
## 182               0          1      0               5.53
## 183               0          0      1              10.27
## 184               0          0      1               0.73
## 185               0          0      1              70.52
## 186               0          0      1               1.90
## 187               0          1      0              37.43
## 188               0          1      0              63.53
## 189               0          0      1              61.77
## 190               0          0      1              52.00
## 191               0          1      0                 NA
## 192               0          1      0               9.57
## 193               0          0      1              42.63
## 194               0          0      1              32.67
## 195               0          0      1              50.77
## 196               0          0      1              56.43
## 197               0          0      1              58.60
## 198               0          0      1              24.37
## 199               0          1      0              23.13
## 200               0          1      0              18.17
## 201               0          0      1              30.33
## 202               0          0      1              59.27
## 203               0          0      1              27.07
## 204               0          0      1              41.29
## 205               0          0      1              28.33
## 206               0          0      1              47.50
## 207               0          0      1              18.47
## 208               0          1      0              56.67
## 209               0          0      1              35.45
## 210               0          1      0               0.43
## 211               0          0      1              36.27
## 212               0          0      1              19.23
## 213               0          0      1              43.87
## 214               0          0      1               1.65
## 215               0          0      1              41.13
## 216               0          0      1              44.93
## 217               0          0      1              39.27
## 218               0          1      0               1.43
## 219               0          0      1              34.70
## 220               0          0      1              10.73
## 221               0          1      0               7.60
## 222               0          0      1              47.50
## 223               0          0      1              23.40
## 224               0          0      1               1.50
## 225               0          0      1               1.43
## 226               0          0      1              44.23
## 227               0          0      1               9.33
## 228               0          0      1               4.73
## 229               0          0      1              35.90
## 230               0          0      1              29.89
## 231               0          1      0               7.47
## 232               0          0      1              44.37
## 233               0          0      1              16.50
## 234               0          0      1              16.87
## 235               0          0      1              34.70
## 236               0          0      1              44.88
## 237               0          0      1              23.23
## 238               0          0      1              33.48
## 239               0          0      1               7.77
## 240               0          0      1              28.99
## 241               0          0      1              46.87
## 242               0          1      0              26.69
## 243               0          0      1              35.93
## 244               0          0      1              35.20
## 245               0          1      0              21.00
## 246               0          1      0               9.23
## 247               0          0      1              30.90
## 248               0          0      1              23.62
## 249               0          0      1              27.80
## 250               0          0      1              12.17
## 251               0          1      0              28.59
## 252               0          1      0              25.30
## 253               0          1      0              20.97
## 254               0          0      1              32.77
## 255               0          0      1              14.03
## 256               0          0      1              22.83
## 257               0          0      1              31.50
## 258               0          0      1              17.29
## 259               0          0      1              19.13
## 260               0          0      1              12.30
## 261               0          0      1              11.23
## 262               0          0      1               1.27
## 263               0          0      1               9.28
## 264               0          0      1               4.63
## 265               0          0      1              11.73
## 266               0          0      1               1.43
## 267               0          0      1               1.30
## 268               0          0      1               3.90
## 269               0          0      1              10.13
## 270               0          0      1               4.99
## 271               0          0      1              13.53
## 272               0          0      1               1.47
## 273               0          0      1               4.10
## 274               0          0      1               2.83
## 275               0          0      1               1.70
## 276               0          0      1               6.60
## 277               0          0      1               1.93
## 278               0          0      1              10.43
## 279               0          0      1              13.60
## 280               0          0      1               4.83
## 281               1          1      0               8.40
## 282               0          0      1               4.17
## 283               0          0      1               2.40
## 284               0          0      1               2.13
## 285               0          1      0               0.30
## 286               0          0      1               5.90
## 287               0          0      1               5.63
## 288               0          0      1               4.40
## 289               0          1      0               1.57
## 290               0          0      1               1.87
## 291               0          0      1               8.30
## 292               0          0      1               1.23
## 293               0          0      1               1.83
## 294               0          0      1               4.33
## 295               0          0      1               1.20
## 296               0          0      1               1.20
## 297               0          0      1               2.03
## 298               0          0      1               3.67
## 299               0          1      0               1.73
## 300               0          0      1               1.17
## 301               0          0      1               1.43
## 302               0          0      1               1.60
## 303               0          1      0               2.60
## 304               0          0      1              86.37
## 305               0          0      1              43.43
## 306               0          0      1              55.53
## 307               0          1      0               3.67
## 308               0          0      1               6.43
## 309               0          0      1              22.83
## 310               0          1      0              21.47
## 311               0          1      0              15.60
## 312               0          0      1              76.03
## 313               0          0      1              65.30
## 314               0          1      0              52.30
## 315               0          0      1              26.77
## 316               0          0      1              24.87

data exploration

glimpse(medicaldata::scurvy)
## Rows: 12
## Columns: 8
## $ study_id                  <chr> "001", "002", "003", "004", "005", "006", "0…
## $ treatment                 <fct> cider, cider, dilute_sulfuric_acid, dilute_s…
## $ dosing_regimen_for_scurvy <chr> "1 quart per day", "1 quart per day", "25 dr…
## $ gum_rot_d6                <fct> 2_moderate, 2_moderate, 1_mild, 2_moderate, …
## $ skin_sores_d6             <fct> 2_moderate, 1_mild, 3_severe, 3_severe, 3_se…
## $ weakness_of_the_knees_d6  <fct> 2_moderate, 2_moderate, 3_severe, 3_severe, …
## $ lassitude_d6              <fct> 2_moderate, 3_severe, 3_severe, 3_severe, 3_…
## $ fit_for_duty_d6           <fct> 0_no, 0_no, 0_no, 0_no, 0_no, 0_no, 0_no, 0_…

using str to explore data

str(medicaldata::scurvy)
## tibble [12 × 8] (S3: tbl_df/tbl/data.frame)
##  $ study_id                 : chr [1:12] "001" "002" "003" "004" ...
##  $ treatment                : Factor w/ 6 levels "cider","citrus",..: 1 1 3 3 6 6 5 5 2 2 ...
##  $ dosing_regimen_for_scurvy: chr [1:12] "1 quart per day" "1 quart per day" "25 drops of elixir of vitriol, three times a day" "25 drops of elixir of vitriol, three times a day" ...
##  $ gum_rot_d6               : Factor w/ 4 levels "0_none","1_mild",..: 3 3 2 3 4 4 4 4 2 1 ...
##  $ skin_sores_d6            : Factor w/ 4 levels "0_none","1_mild",..: 3 2 4 4 4 4 4 4 2 1 ...
##  $ weakness_of_the_knees_d6 : Factor w/ 4 levels "0_none","1_mild",..: 3 3 4 4 4 4 4 4 1 1 ...
##  $ lassitude_d6             : Factor w/ 4 levels "0_none","1_mild",..: 3 4 4 4 4 4 4 4 2 1 ...
##  $ fit_for_duty_d6          : Factor w/ 2 levels "0_no","1_yes": 1 1 1 1 1 1 1 1 1 2 ...

mean of strep_tb patient_id

mean(medicaldata::strep_tb$patient_id)
## [1] 54
str(medicaldata::strep_tb$patient_id)
##  int [1:107] 1 2 3 4 5 6 7 8 9 10 ...
is.numeric(medicaldata::strep_tb$patient_id)
## [1] TRUE

快速检阅数据

head(medicaldata::scurvy)
## # A tibble: 6 × 8
##   study_id treatment            dosing_regimen_for_sc…¹ gum_rot_d6 skin_sores_d6
##   <chr>    <fct>                <chr>                   <fct>      <fct>        
## 1 001      cider                1 quart per day         2_moderate 2_moderate   
## 2 002      cider                1 quart per day         2_moderate 1_mild       
## 3 003      dilute_sulfuric_acid 25 drops of elixir of … 1_mild     3_severe     
## 4 004      dilute_sulfuric_acid 25 drops of elixir of … 2_moderate 3_severe     
## 5 005      vinegar              two spoonfuls, three t… 3_severe   3_severe     
## 6 006      vinegar              two spoonfuls, three t… 3_severe   3_severe     
## # ℹ abbreviated name: ¹​dosing_regimen_for_scurvy
## # ℹ 3 more variables: weakness_of_the_knees_d6 <fct>, lassitude_d6 <fct>,
## #   fit_for_duty_d6 <fct>
tail(medicaldata::strep_tb)
##     patient_id          arm dose_strep_g dose_PAS_g gender baseline_condition
## 102        100 Streptomycin            2          0      M             3_Poor
## 103        101 Streptomycin            2          0      F             3_Poor
## 104        104 Streptomycin            2          0      M             3_Poor
## 105        105 Streptomycin            2          0      F             3_Poor
## 106        106 Streptomycin            2          0      F             3_Poor
## 107        107 Streptomycin            2          0      F             3_Poor
##             baseline_temp baseline_esr baseline_cavitation strep_resistance
## 102 2_99-99.9F/37.3-37.7C        4_51+                 yes    3_resist_100+
## 103        4_>=101F/38.3C        4_51+                 yes    3_resist_100+
## 104        4_>=101F/38.3C        4_51+                 yes    3_resist_100+
## 105        4_>=101F/38.3C        4_51+                 yes    3_resist_100+
## 106        4_>=101F/38.3C        4_51+                 yes    3_resist_100+
## 107        4_>=101F/38.3C        4_51+                 yes    3_resist_100+
##                    radiologic_6m rad_num improved
## 102                  4_No_change       4    FALSE
## 103 2_Considerable_deterioration       2    FALSE
## 104       5_Moderate_improvement       5     TRUE
## 105 2_Considerable_deterioration       2    FALSE
## 106                      1_Death       1    FALSE
## 107   6_Considerable_improvement       6     TRUE
head(as.data.frame(medicaldata::scurvy))
##   study_id            treatment
## 1      001                cider
## 2      002                cider
## 3      003 dilute_sulfuric_acid
## 4      004 dilute_sulfuric_acid
## 5      005              vinegar
## 6      006              vinegar
##                          dosing_regimen_for_scurvy gum_rot_d6 skin_sores_d6
## 1                                  1 quart per day 2_moderate    2_moderate
## 2                                  1 quart per day 2_moderate        1_mild
## 3 25 drops of elixir of vitriol, three times a day     1_mild      3_severe
## 4 25 drops of elixir of vitriol, three times a day 2_moderate      3_severe
## 5                 two spoonfuls, three times daily   3_severe      3_severe
## 6                 two spoonfuls, three times daily   3_severe      3_severe
##   weakness_of_the_knees_d6 lassitude_d6 fit_for_duty_d6
## 1               2_moderate   2_moderate            0_no
## 2               2_moderate     3_severe            0_no
## 3                 3_severe     3_severe            0_no
## 4                 3_severe     3_severe            0_no
## 5                 3_severe     3_severe            0_no
## 6                 3_severe     3_severe            0_no
# 查看全列,width = Inf
print(tail(medicaldata::strep_tb, width = Inf))
##     patient_id          arm dose_strep_g dose_PAS_g gender baseline_condition
## 102        100 Streptomycin            2          0      M             3_Poor
## 103        101 Streptomycin            2          0      F             3_Poor
## 104        104 Streptomycin            2          0      M             3_Poor
## 105        105 Streptomycin            2          0      F             3_Poor
## 106        106 Streptomycin            2          0      F             3_Poor
## 107        107 Streptomycin            2          0      F             3_Poor
##             baseline_temp baseline_esr baseline_cavitation strep_resistance
## 102 2_99-99.9F/37.3-37.7C        4_51+                 yes    3_resist_100+
## 103        4_>=101F/38.3C        4_51+                 yes    3_resist_100+
## 104        4_>=101F/38.3C        4_51+                 yes    3_resist_100+
## 105        4_>=101F/38.3C        4_51+                 yes    3_resist_100+
## 106        4_>=101F/38.3C        4_51+                 yes    3_resist_100+
## 107        4_>=101F/38.3C        4_51+                 yes    3_resist_100+
##                    radiologic_6m rad_num improved
## 102                  4_No_change       4    FALSE
## 103 2_Considerable_deterioration       2    FALSE
## 104       5_Moderate_improvement       5     TRUE
## 105 2_Considerable_deterioration       2    FALSE
## 106                      1_Death       1    FALSE
## 107   6_Considerable_improvement       6     TRUE
# 查看全行,n = Inf
print(tail(medicaldata::strep_tb, n = Inf))
##     patient_id          arm dose_strep_g dose_PAS_g gender baseline_condition
## 1            1      Control            0          0      M             1_Good
## 2            2      Control            0          0      F             1_Good
## 3            3      Control            0          0      F             1_Good
## 4            4      Control            0          0      M             1_Good
## 5            5      Control            0          0      F             1_Good
## 6            6      Control            0          0      M             1_Good
## 7            7      Control            0          0      F             1_Good
## 8            8      Control            0          0      M             1_Good
## 9            9      Control            0          0      F             2_Fair
## 10          10      Control            0          0      M             2_Fair
## 11          11      Control            0          0      F             2_Fair
## 12          12      Control            0          0      M             2_Fair
## 13          13      Control            0          0      F             2_Fair
## 14          14      Control            0          0      M             2_Fair
## 15          15      Control            0          0      F             2_Fair
## 16          16      Control            0          0      M             2_Fair
## 17          17      Control            0          0      F             2_Fair
## 18          18      Control            0          0      M             2_Fair
## 19          19      Control            0          0      F             2_Fair
## 20          20      Control            0          0      M             2_Fair
## 21          21      Control            0          0      F             2_Fair
## 22          22      Control            0          0      M             2_Fair
## 23          23      Control            0          0      F             2_Fair
## 24          24      Control            0          0      M             2_Fair
## 25          25      Control            0          0      F             2_Fair
## 26          26      Control            0          0      M             2_Fair
## 27          27      Control            0          0      F             2_Fair
## 28          28      Control            0          0      M             2_Fair
## 29          29      Control            0          0      F             3_Poor
## 30          30      Control            0          0      F             3_Poor
## 31          31      Control            0          0      M             3_Poor
## 32          32      Control            0          0      F             3_Poor
## 33          33      Control            0          0      M             3_Poor
## 34          34      Control            0          0      F             3_Poor
## 35          35      Control            0          0      M             3_Poor
## 36          36      Control            0          0      F             3_Poor
## 37          37      Control            0          0      M             3_Poor
## 38          38      Control            0          0      F             3_Poor
## 39          39      Control            0          0      F             3_Poor
## 40          40      Control            0          0      M             3_Poor
## 41          41      Control            0          0      F             3_Poor
## 42          42      Control            0          0      M             3_Poor
## 43          43      Control            0          0      F             3_Poor
## 44          44      Control            0          0      M             3_Poor
## 45          45      Control            0          0      F             3_Poor
## 46          46      Control            0          0      F             3_Poor
## 47          47      Control            0          0      F             3_Poor
## 48          48      Control            0          0      M             3_Poor
## 49          49      Control            0          0      F             3_Poor
## 50          50      Control            0          0      M             3_Poor
## 51          51      Control            0          0      F             3_Poor
## 52          52      Control            0          0      M             3_Poor
## 53          53 Streptomycin            2          0      M             1_Good
## 54          55 Streptomycin            2          0      F             1_Good
## 55          56 Streptomycin            2          0      M             1_Good
## 56          57 Streptomycin            2          0      F             1_Good
## 57          58 Streptomycin            2          0      M             1_Good
## 58          59 Streptomycin            2          0      F             1_Good
## 59          60 Streptomycin            2          0      M             1_Good
## 60          67 Streptomycin            2          0      F             1_Good
## 61          74 Streptomycin            2          0      M             2_Fair
## 62          54 Streptomycin            2          0      F             2_Fair
## 63          61 Streptomycin            2          0      F             2_Fair
## 64          68 Streptomycin            2          0      M             2_Fair
## 65          75 Streptomycin            2          0      F             2_Fair
## 66          62 Streptomycin            2          0      M             2_Fair
## 67          63 Streptomycin            2          0      F             2_Fair
## 68          64 Streptomycin            2          0      M             2_Fair
## 69          65 Streptomycin            2          0      F             2_Fair
## 70          66 Streptomycin            2          0      M             2_Fair
## 71          69 Streptomycin            2          0      F             2_Fair
## 72          70 Streptomycin            2          0      M             2_Fair
## 73          71 Streptomycin            2          0      F             2_Fair
## 74          72 Streptomycin            2          0      M             2_Fair
## 75          73 Streptomycin            2          0      F             2_Fair
## 76          81 Streptomycin            2          0      F             2_Fair
## 77          88 Streptomycin            2          0      F             2_Fair
## 78          82 Streptomycin            2          0      F             3_Poor
## 79          89 Streptomycin            2          0      M             3_Poor
## 80          76 Streptomycin            2          0      M             3_Poor
## 81          77 Streptomycin            2          0      F             3_Poor
## 82          78 Streptomycin            2          0      M             3_Poor
## 83          79 Streptomycin            2          0      F             3_Poor
## 84          80 Streptomycin            2          0      M             3_Poor
## 85          83 Streptomycin            2          0      M             3_Poor
## 86          84 Streptomycin            2          0      F             3_Poor
## 87          85 Streptomycin            2          0      M             3_Poor
## 88          86 Streptomycin            2          0      F             3_Poor
## 89          87 Streptomycin            2          0      M             3_Poor
## 90          90 Streptomycin            2          0      F             3_Poor
## 91          91 Streptomycin            2          0      F             3_Poor
## 92          95 Streptomycin            2          0      F             3_Poor
## 93         102 Streptomycin            2          0      M             3_Poor
## 94          96 Streptomycin            2          0      M             3_Poor
## 95         103 Streptomycin            2          0      F             3_Poor
## 96          92 Streptomycin            2          0      M             3_Poor
## 97          93 Streptomycin            2          0      F             3_Poor
## 98          94 Streptomycin            2          0      M             3_Poor
## 99          97 Streptomycin            2          0      F             3_Poor
## 100         98 Streptomycin            2          0      F             3_Poor
## 101         99 Streptomycin            2          0      F             3_Poor
## 102        100 Streptomycin            2          0      M             3_Poor
## 103        101 Streptomycin            2          0      F             3_Poor
## 104        104 Streptomycin            2          0      M             3_Poor
## 105        105 Streptomycin            2          0      F             3_Poor
## 106        106 Streptomycin            2          0      F             3_Poor
## 107        107 Streptomycin            2          0      F             3_Poor
##                          baseline_temp baseline_esr baseline_cavitation
## 1                      1_<=98.9F/37.2C      2_11-20                 yes
## 2              3_100-100.9F/37.8-38.2C      2_11-20                  no
## 3                      1_<=98.9F/37.2C      3_21-50                  no
## 4                      1_<=98.9F/37.2C      3_21-50                  no
## 5                2_99-99.9F/37.3-37.7C      3_21-50                  no
## 6              3_100-100.9F/37.8-38.2C      3_21-50                  no
## 7                2_99-99.9F/37.3-37.7C      3_21-50                 yes
## 8                2_99-99.9F/37.3-37.7C      3_21-50                 yes
## 9                2_99-99.9F/37.3-37.7C      3_21-50                 yes
## 10                      4_>=101F/38.3C      3_21-50                 yes
## 11             3_100-100.9F/37.8-38.2C      3_21-50                  no
## 12               2_99-99.9F/37.3-37.7C      3_21-50                 yes
## 13               2_99-99.9F/37.3-37.7C      3_21-50                 yes
## 14                      4_>=101F/38.3C      3_21-50                 yes
## 15               2_99-99.9F/37.3-37.7C      3_21-50                 yes
## 16             3_100-100.9F/37.8-38.2C      3_21-50                  no
## 17             3_100-100.9F/37.8-38.2C      3_21-50                  no
## 18                     1_<=98.9F/37.2C      3_21-50                  no
## 19             3_100-100.9F/37.8-38.2C      3_21-50                  no
## 20             3_100-100.9F/37.8-38.2C      3_21-50                  no
## 21             3_100-100.9F/37.8-38.2C      3_21-50                  no
## 22             3_100-100.9F/37.8-38.2C      3_21-50                  no
## 23               2_99-99.9F/37.3-37.7C        4_51+                 yes
## 24               2_99-99.9F/37.3-37.7C        4_51+                  no
## 25               2_99-99.9F/37.3-37.7C        4_51+                  no
## 26             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 27             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 28             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 29               2_99-99.9F/37.3-37.7C        4_51+                 yes
## 30                      4_>=101F/38.3C        4_51+                 yes
## 31                      4_>=101F/38.3C        4_51+                 yes
## 32                      4_>=101F/38.3C        4_51+                 yes
## 33                      4_>=101F/38.3C        4_51+                  no
## 34                      4_>=101F/38.3C        4_51+                  no
## 35                      4_>=101F/38.3C        4_51+                  no
## 36                      4_>=101F/38.3C        4_51+                  no
## 37                      4_>=101F/38.3C        4_51+                  no
## 38                      4_>=101F/38.3C        4_51+                 yes
## 39                      4_>=101F/38.3C        4_51+                  no
## 40                      4_>=101F/38.3C        4_51+                 yes
## 41             3_100-100.9F/37.8-38.2C        4_51+                  no
## 42             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 43             3_100-100.9F/37.8-38.2C         <NA>                 yes
## 44             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 45             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 46               2_99-99.9F/37.3-37.7C        4_51+                 yes
## 47                      4_>=101F/38.3C        4_51+                 yes
## 48                      4_>=101F/38.3C        4_51+                 yes
## 49                      4_>=101F/38.3C        4_51+                 yes
## 50                      4_>=101F/38.3C        4_51+                 yes
## 51                      4_>=101F/38.3C        4_51+                 yes
## 52                      4_>=101F/38.3C        4_51+                 yes
## 53                      4_>=101F/38.3C      2_11-20                  no
## 54                     1_<=98.9F/37.2C      2_11-20                  no
## 55                     1_<=98.9F/37.2C      3_21-50                  no
## 56                     1_<=98.9F/37.2C      3_21-50                  no
## 57               2_99-99.9F/37.3-37.7C      3_21-50                  no
## 58               2_99-99.9F/37.3-37.7C      3_21-50                  no
## 59               2_99-99.9F/37.3-37.7C      3_21-50                  no
## 60               2_99-99.9F/37.3-37.7C      3_21-50                  no
## 61             3_100-100.9F/37.8-38.2C      3_21-50                  no
## 62               2_99-99.9F/37.3-37.7C      2_11-20                  no
## 63               2_99-99.9F/37.3-37.7C      3_21-50                  no
## 64                      4_>=101F/38.3C      3_21-50                  no
## 65             3_100-100.9F/37.8-38.2C        4_51+                  no
## 66               2_99-99.9F/37.3-37.7C      3_21-50                  no
## 67                      4_>=101F/38.3C      3_21-50                  no
## 68    2_99-99.9F/37.3-37.7C/37.3-37.7C      3_21-50                  no
## 69               2_99-99.9F/37.3-37.7C      3_21-50                  no
## 70               2_99-99.9F/37.3-37.7C      3_21-50                  no
## 71                      4_>=101F/38.3C      3_21-50                  no
## 72                      4_>=101F/38.3C      3_21-50                  no
## 73                      4_>=101F/38.3C        4_51+                  no
## 74                      4_>=101F/38.3C        4_51+                  no
## 75             3_100-100.9F/37.8-38.2C        4_51+                  no
## 76             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 77             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 78             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 79             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 80             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 81                      4_>=101F/38.3C        4_51+                 yes
## 82             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 83             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 84             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 85  3_100-100.9F/37.8-38.2C/37.8-38.2C        4_51+                 yes
## 86             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 87             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 88                      4_>=101F/38.3C        4_51+                 yes
## 89                      4_>=101F/38.3C        4_51+                 yes
## 90                      4_>=101F/38.3C        4_51+                 yes
## 91             3_100-100.9F/37.8-38.2C        4_51+                 yes
## 92               2_99-99.9F/37.3-37.7C        4_51+                 yes
## 93                      4_>=101F/38.3C        4_51+                 yes
## 94                      4_>=101F/38.3C        4_51+                 yes
## 95                      4_>=101F/38.3C        4_51+                 yes
## 96                      4_>=101F/38.3C        4_51+                 yes
## 97                      4_>=101F/38.3C        4_51+                 yes
## 98               2_99-99.9F/37.3-37.7C        4_51+                 yes
## 99                      4_>=101F/38.3C        4_51+                 yes
## 100                     4_>=101F/38.3C        4_51+                 yes
## 101                     4_>=101F/38.3C        4_51+                 yes
## 102              2_99-99.9F/37.3-37.7C        4_51+                 yes
## 103                     4_>=101F/38.3C        4_51+                 yes
## 104                     4_>=101F/38.3C        4_51+                 yes
## 105                     4_>=101F/38.3C        4_51+                 yes
## 106                     4_>=101F/38.3C        4_51+                 yes
## 107                     4_>=101F/38.3C        4_51+                 yes
##     strep_resistance                radiologic_6m rad_num improved
## 1         1_sens_0-8   6_Considerable_improvement       6     TRUE
## 2         1_sens_0-8       5_Moderate_improvement       5     TRUE
## 3         1_sens_0-8       5_Moderate_improvement       5     TRUE
## 4         1_sens_0-8       5_Moderate_improvement       5     TRUE
## 5         1_sens_0-8       5_Moderate_improvement       5     TRUE
## 6         1_sens_0-8   6_Considerable_improvement       6     TRUE
## 7         1_sens_0-8       5_Moderate_improvement       5     TRUE
## 8         1_sens_0-8       5_Moderate_improvement       5     TRUE
## 9         1_sens_0-8       5_Moderate_improvement       5     TRUE
## 10        1_sens_0-8       5_Moderate_improvement       5     TRUE
## 11        1_sens_0-8   6_Considerable_improvement       6     TRUE
## 12        1_sens_0-8       5_Moderate_improvement       5     TRUE
## 13        1_sens_0-8       5_Moderate_improvement       5     TRUE
## 14        1_sens_0-8       5_Moderate_improvement       5     TRUE
## 15        1_sens_0-8       5_Moderate_improvement       5     TRUE
## 16        1_sens_0-8   6_Considerable_improvement       6     TRUE
## 17        1_sens_0-8       5_Moderate_improvement       5     TRUE
## 18        1_sens_0-8                  4_No_change       4    FALSE
## 19        1_sens_0-8     3_Moderate_deterioration       3    FALSE
## 20        1_sens_0-8     3_Moderate_deterioration       3    FALSE
## 21        1_sens_0-8     3_Moderate_deterioration       3    FALSE
## 22        1_sens_0-8     3_Moderate_deterioration       3    FALSE
## 23        1_sens_0-8                  4_No_change       4    FALSE
## 24        1_sens_0-8     3_Moderate_deterioration       3    FALSE
## 25        1_sens_0-8     3_Moderate_deterioration       3    FALSE
## 26        1_sens_0-8     3_Moderate_deterioration       3    FALSE
## 27        1_sens_0-8     3_Moderate_deterioration       3    FALSE
## 28        1_sens_0-8     3_Moderate_deterioration       3    FALSE
## 29        1_sens_0-8                  4_No_change       4    FALSE
## 30        1_sens_0-8     3_Moderate_deterioration       3    FALSE
## 31        1_sens_0-8     3_Moderate_deterioration       3    FALSE
## 32        1_sens_0-8     3_Moderate_deterioration       3    FALSE
## 33        1_sens_0-8 2_Considerable_deterioration       2    FALSE
## 34        1_sens_0-8 2_Considerable_deterioration       2    FALSE
## 35        1_sens_0-8 2_Considerable_deterioration       2    FALSE
## 36        1_sens_0-8 2_Considerable_deterioration       2    FALSE
## 37        1_sens_0-8                      1_Death       1    FALSE
## 38        1_sens_0-8 2_Considerable_deterioration       2    FALSE
## 39        1_sens_0-8                      1_Death       1    FALSE
## 40        1_sens_0-8 2_Considerable_deterioration       2    FALSE
## 41        1_sens_0-8                      1_Death       1    FALSE
## 42        1_sens_0-8                      1_Death       1    FALSE
## 43        1_sens_0-8                      1_Death       1    FALSE
## 44        1_sens_0-8                      1_Death       1    FALSE
## 45        1_sens_0-8                      1_Death       1    FALSE
## 46        1_sens_0-8                      1_Death       1    FALSE
## 47        1_sens_0-8                      1_Death       1    FALSE
## 48        1_sens_0-8                      1_Death       1    FALSE
## 49        1_sens_0-8                      1_Death       1    FALSE
## 50        1_sens_0-8                      1_Death       1    FALSE
## 51        1_sens_0-8                      1_Death       1    FALSE
## 52        1_sens_0-8                      1_Death       1    FALSE
## 53        1_sens_0-8   6_Considerable_improvement       6     TRUE
## 54        1_sens_0-8   6_Considerable_improvement       6     TRUE
## 55        1_sens_0-8   6_Considerable_improvement       6     TRUE
## 56        1_sens_0-8   6_Considerable_improvement       6     TRUE
## 57        1_sens_0-8   6_Considerable_improvement       6     TRUE
## 58        1_sens_0-8   6_Considerable_improvement       6     TRUE
## 59        1_sens_0-8   6_Considerable_improvement       6     TRUE
## 60        1_sens_0-8   6_Considerable_improvement       6     TRUE
## 61        1_sens_0-8   6_Considerable_improvement       6     TRUE
## 62        2_mod_8-99   6_Considerable_improvement       6     TRUE
## 63        2_mod_8-99   6_Considerable_improvement       6     TRUE
## 64        2_mod_8-99   6_Considerable_improvement       6     TRUE
## 65        2_mod_8-99       5_Moderate_improvement       5     TRUE
## 66     3_resist_100+ 2_Considerable_deterioration       2    FALSE
## 67     3_resist_100+ 2_Considerable_deterioration       2    FALSE
## 68     3_resist_100+   6_Considerable_improvement       6     TRUE
## 69     3_resist_100+       5_Moderate_improvement       5     TRUE
## 70     3_resist_100+   6_Considerable_improvement       6     TRUE
## 71     3_resist_100+     3_Moderate_deterioration       3    FALSE
## 72     3_resist_100+   6_Considerable_improvement       6     TRUE
## 73     3_resist_100+   6_Considerable_improvement       6     TRUE
## 74     3_resist_100+       5_Moderate_improvement       5     TRUE
## 75     3_resist_100+   6_Considerable_improvement       6     TRUE
## 76        1_sens_0-8   6_Considerable_improvement       6     TRUE
## 77        1_sens_0-8       5_Moderate_improvement       5     TRUE
## 78        2_mod_8-99   6_Considerable_improvement       6     TRUE
## 79        2_mod_8-99       5_Moderate_improvement       5     TRUE
## 80     3_resist_100+   6_Considerable_improvement       6     TRUE
## 81     3_resist_100+                      1_Death       1    FALSE
## 82     3_resist_100+       5_Moderate_improvement       5     TRUE
## 83     3_resist_100+   6_Considerable_improvement       6     TRUE
## 84     3_resist_100+     3_Moderate_deterioration       3    FALSE
## 85     3_resist_100+   6_Considerable_improvement       6     TRUE
## 86     3_resist_100+   6_Considerable_improvement       6     TRUE
## 87     3_resist_100+   6_Considerable_improvement       6     TRUE
## 88     3_resist_100+                      1_Death       1    FALSE
## 89     3_resist_100+                  4_No_change       4    FALSE
## 90     3_resist_100+     3_Moderate_deterioration       3    FALSE
## 91     3_resist_100+     3_Moderate_deterioration       3    FALSE
## 92        1_sens_0-8 2_Considerable_deterioration       2    FALSE
## 93        1_sens_0-8   6_Considerable_improvement       6     TRUE
## 94        2_mod_8-99   6_Considerable_improvement       6     TRUE
## 95        2_mod_8-99       5_Moderate_improvement       5     TRUE
## 96     3_resist_100+   6_Considerable_improvement       6     TRUE
## 97     3_resist_100+       5_Moderate_improvement       5     TRUE
## 98     3_resist_100+ 2_Considerable_deterioration       2    FALSE
## 99     3_resist_100+       5_Moderate_improvement       5     TRUE
## 100    3_resist_100+     3_Moderate_deterioration       3    FALSE
## 101    3_resist_100+                      1_Death       1    FALSE
## 102    3_resist_100+                  4_No_change       4    FALSE
## 103    3_resist_100+ 2_Considerable_deterioration       2    FALSE
## 104    3_resist_100+       5_Moderate_improvement       5     TRUE
## 105    3_resist_100+ 2_Considerable_deterioration       2    FALSE
## 106    3_resist_100+                      1_Death       1    FALSE
## 107    3_resist_100+   6_Considerable_improvement       6     TRUE
View(medicaldata::strep_tb)
#check that radiologic_6m, rad_num, and improved all match,用slice_sample随机阅览数据
medicaldata::strep_tb %>% 
  slice_sample(prop = 0.1) %>% 
  select(radiologic_6m, rad_num, improved)
##                   radiologic_6m rad_num improved
## 1      3_Moderate_deterioration       3    FALSE
## 2    6_Considerable_improvement       6     TRUE
## 3        5_Moderate_improvement       5     TRUE
## 4    6_Considerable_improvement       6     TRUE
## 5    6_Considerable_improvement       6     TRUE
## 6    6_Considerable_improvement       6     TRUE
## 7                   4_No_change       4    FALSE
## 8    6_Considerable_improvement       6     TRUE
## 9  2_Considerable_deterioration       2    FALSE
## 10                  4_No_change       4    FALSE

More exploration with skimr and DataExplorer

library(skimr)
library(DataExplorer)
skimr::skim(medicaldata::strep_tb)
Data summary
Name medicaldata::strep_tb
Number of rows 107
Number of columns 13
_______________________
Column type frequency:
character 8
logical 1
numeric 4
________________________
Group variables None

Variable type: character

skim_variable n_missing complete_rate min max empty n_unique whitespace
arm 0 1.00 7 12 0 2 0
gender 0 1.00 1 1 0 2 0
baseline_condition 0 1.00 6 6 0 3 0
baseline_temp 0 1.00 14 34 0 6 0
baseline_esr 1 0.99 5 7 0 3 0
baseline_cavitation 0 1.00 2 3 0 2 0
strep_resistance 0 1.00 10 13 0 3 0
radiologic_6m 0 1.00 7 28 0 6 0

Variable type: logical

skim_variable n_missing complete_rate mean count
improved 0 1 0.51 TRU: 55, FAL: 52

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
patient_id 0 1 54.00 31.03 1 27.5 54 80.5 107 ▇▇▇▇▇
dose_strep_g 0 1 1.03 1.00 0 0.0 2 2.0 2 ▇▁▁▁▇
dose_PAS_g 0 1 0.00 0.00 0 0.0 0 0.0 0 ▁▁▇▁▁
rad_num 0 1 3.93 1.89 1 2.0 5 6.0 6 ▇▅▁▆▇
DataExplorer::create_report(medicaldata::strep_tb)
## 
## 
## processing file: report.rmd
##   |                                             |                                     |   0%  |                                             |.                                    |   2%                                   |                                             |..                                   |   5% [global_options]                  |                                             |...                                  |   7%                                   |                                             |....                                 |  10% [introduce]                       |                                             |....                                 |  12%                                   |                                             |.....                                |  14% [plot_intro]
##   |                                             |......                               |  17%                                   |                                             |.......                              |  19% [data_structure]                  |                                             |........                             |  21%                                   |                                             |.........                            |  24% [missing_profile]
##   |                                             |..........                           |  26%                                   |                                             |...........                          |  29% [univariate_distribution_header]  |                                             |...........                          |  31%                                   |                                             |............                         |  33% [plot_histogram]
##   |                                             |.............                        |  36%                                   |                                             |..............                       |  38% [plot_density]                    |                                             |...............                      |  40%                                   |                                             |................                     |  43% [plot_frequency_bar]
##   |                                             |.................                    |  45%                                   |                                             |..................                   |  48% [plot_response_bar]               |                                             |..................                   |  50%                                   |                                             |...................                  |  52% [plot_with_bar]                   |                                             |....................                 |  55%                                   |                                             |.....................                |  57% [plot_normal_qq]
##   |                                             |......................               |  60%                                   |                                             |.......................              |  62% [plot_response_qq]                |                                             |........................             |  64%                                   |                                             |.........................            |  67% [plot_by_qq]                      |                                             |..........................           |  69%                                   |                                             |..........................           |  71% [correlation_analysis]
##   |                                             |...........................          |  74%                                   |                                             |............................         |  76% [principal_component_analysis]
##   |                                             |.............................        |  79%                                   |                                             |..............................       |  81% [bivariate_distribution_header]   |                                             |...............................      |  83%                                   |                                             |................................     |  86% [plot_response_boxplot]           |                                             |.................................    |  88%                                   |                                             |.................................    |  90% [plot_by_boxplot]                 |                                             |..................................   |  93%                                   |                                             |...................................  |  95% [plot_response_scatterplot]       |                                             |.................................... |  98%                                   |                                             |.....................................| 100% [plot_by_scatterplot]           
## output file: D:/rstudio workspace/study/report.knit.md
## "D:/RStudio/resources/app/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS "D:\RSTUDI~1\study\REPORT~1.MD" --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc583c51d95a8a.html --lua-filter "D:\R-4.4.1\library\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "D:\R-4.4.1\library\rmarkdown\rmarkdown\lua\latex-div.lua" --embed-resources --standalone --variable bs3=TRUE --section-divs --table-of-contents --toc-depth 6 --template "D:\R-4.4.1\library\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable theme=yeti --mathjax --variable "mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --include-in-header "C:\Users\86186\AppData\Local\Temp\RtmpiuNIvy\rmarkdown-str583c90446f.html"
## 
## Output created: report.html
Variable Type Long form Abbreviation
Logical (TRUE/FALSE) col_logical() l
Integer col_integer() i
Double col_double() d
Character col_character() c
Factor (nominal or ordinal) col_factor(levels, ordered) f
Date col_date(format) D
Time col_time(format) t
Date & Time col_datetime(format) T
Number col_number() n
Don’t import col_skip() -
Default Guessing col_guess() ?