Coerce an mrgsimsds object to a tbl
Usage
# S3 method for class 'mrgsimsds'
as_tibble(x, ...)
# S3 method for class 'mrgsimsds'
collect(x, ...)
# S3 method for class 'mrgsimsds'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)Arguments
- x
an mrgsimsds object.
- ...
passed to
dplyr::as_tibble()ordplyr::collect().- row.names
passed to
base::as.data.frame().- optional
passed to
base::as.data.frame().
Examples
mod <- house_ds(end = 5)
out <- mrgsim_ds(mod, events = ev(amt = 100))
as.data.frame(out)
#> ID time GUT CENT RESP DV CP
#> 1 1 0.00 0.0000000 0.00000 50.00000 0.000000 0.000000
#> 2 1 0.00 100.0000000 0.00000 50.00000 0.000000 0.000000
#> 3 1 0.25 74.0818221 25.74883 48.68223 1.287441 1.287441
#> 4 1 0.50 54.8811636 44.50417 46.18005 2.225208 2.225208
#> 5 1 0.75 40.6569660 58.08258 43.61333 2.904129 2.904129
#> 6 1 1.00 30.1194212 67.82976 41.37943 3.391488 3.391488
#> 7 1 1.25 22.3130160 74.74256 39.57649 3.737128 3.737128
#> 8 1 1.50 16.5298888 79.55944 38.18381 3.977972 3.977972
#> 9 1 1.75 12.2456428 82.82739 37.14045 4.141369 4.141369
#> 10 1 2.00 9.0717953 84.95160 36.37858 4.247580 4.247580
#> 11 1 2.25 6.7205513 86.23219 35.83664 4.311610 4.311610
#> 12 1 2.50 4.9787069 86.89146 35.46331 4.344573 4.344573
#> 13 1 2.75 3.6883168 87.09404 35.21773 4.354702 4.354702
#> 14 1 3.00 2.7323723 86.96184 35.06817 4.348092 4.348092
#> 15 1 3.25 2.0241912 86.58513 34.99041 4.329257 4.329257
#> 16 1 3.50 1.4995577 86.03076 34.96614 4.301538 4.301538
#> 17 1 3.75 1.1108997 85.34819 34.98160 4.267409 4.267409
#> 18 1 4.00 0.8229747 84.57402 35.02650 4.228701 4.228701
#> 19 1 4.25 0.6096747 83.73533 35.09315 4.186766 4.186766
#> 20 1 4.50 0.4516581 82.85214 35.17583 4.142607 4.142607
#> 21 1 4.75 0.3345965 81.93923 35.27026 4.096961 4.096961
#> 22 1 5.00 0.2478752 81.00752 35.37329 4.050376 4.050376
tibble::as_tibble(out)
#> # A tibble: 22 × 7
#> ID time GUT CENT RESP DV CP
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 0 0 0 50 0 0
#> 2 1 0 100 0 50 0 0
#> 3 1 0.25 74.1 25.7 48.7 1.29 1.29
#> 4 1 0.5 54.9 44.5 46.2 2.23 2.23
#> 5 1 0.75 40.7 58.1 43.6 2.90 2.90
#> 6 1 1 30.1 67.8 41.4 3.39 3.39
#> 7 1 1.25 22.3 74.7 39.6 3.74 3.74
#> 8 1 1.5 16.5 79.6 38.2 3.98 3.98
#> 9 1 1.75 12.2 82.8 37.1 4.14 4.14
#> 10 1 2 9.07 85.0 36.4 4.25 4.25
#> # ℹ 12 more rows
dplyr::collect(out)
#> # A tibble: 22 × 7
#> ID time GUT CENT RESP DV CP
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 0 0 0 50 0 0
#> 2 1 0 100 0 50 0 0
#> 3 1 0.25 74.1 25.7 48.7 1.29 1.29
#> 4 1 0.5 54.9 44.5 46.2 2.23 2.23
#> 5 1 0.75 40.7 58.1 43.6 2.90 2.90
#> 6 1 1 30.1 67.8 41.4 3.39 3.39
#> 7 1 1.25 22.3 74.7 39.6 3.74 3.74
#> 8 1 1.5 16.5 79.6 38.2 3.98 3.98
#> 9 1 1.75 12.2 82.8 37.1 4.14 4.14
#> 10 1 2 9.07 85.0 36.4 4.25 4.25
#> # ℹ 12 more rows