| 1 | # tbl_format_body() results |
| 2 | |
| 3 | Code |
| 4 | # Various column types |
| 5 | tbl_format_body(tbl_format_setup(df_all, width = 30)) |
| 6 | Output |
| 7 | <tbl_format_body(setup)> |
| 8 | a b c d |
| 9 | <dbl> <int> <lgl> <chr> |
| 10 | 1 1 1 TRUE a |
| 11 | 2 2.5 2 FALSE b |
| 12 | 3 NA NA NA <NA> |
| 13 | Code |
| 14 | tbl_format_body(tbl_format_setup(df_all, width = 300)) |
| 15 | Output |
| 16 | <tbl_format_body(setup)> |
| 17 | a b c d e f g h |
| 18 | <dbl> <int> <lgl> <chr> <fct> <date> <dttm> <list> |
| 19 | 1 1 1 TRUE a a 2015-12-10 2015-12-09 10:51:35 <int [1]> |
| 20 | 2 2.5 2 FALSE b b 2015-12-11 2015-12-09 10:51:36 <int [1]> |
| 21 | 3 NA NA NA <NA> <NA> NA NA <int [1]> |
| 22 | i |
| 23 | <list> |
| 24 | 1 <list [2]> |
| 25 | 2 <list [1]> |
| 26 | 3 <list [1]> |
| 27 | Code |
| 28 | # POSIXct and POSIXlt |
| 29 | df <- new_tbl(list(x = as.POSIXct("2016-01-01 12:34:56 GMT") + 1:12)) |
| 30 | df$y <- as.POSIXlt(df$x) |
| 31 | tbl_format_body(tbl_format_setup(df, width = 60L)) |
| 32 | Output |
| 33 | <tbl_format_body(setup)> |
| 34 | x y |
| 35 | <dttm> <dttm> |
| 36 | 1 2016-01-01 12:34:57 2016-01-01 12:34:57 |
| 37 | 2 2016-01-01 12:34:58 2016-01-01 12:34:58 |
| 38 | 3 2016-01-01 12:34:59 2016-01-01 12:34:59 |
| 39 | 4 2016-01-01 12:35:00 2016-01-01 12:35:00 |
| 40 | 5 2016-01-01 12:35:01 2016-01-01 12:35:01 |
| 41 | 6 2016-01-01 12:35:02 2016-01-01 12:35:02 |
| 42 | 7 2016-01-01 12:35:03 2016-01-01 12:35:03 |
| 43 | 8 2016-01-01 12:35:04 2016-01-01 12:35:04 |
| 44 | 9 2016-01-01 12:35:05 2016-01-01 12:35:05 |
| 45 | 10 2016-01-01 12:35:06 2016-01-01 12:35:06 |
| 46 | 11 2016-01-01 12:35:07 2016-01-01 12:35:07 |
| 47 | 12 2016-01-01 12:35:08 2016-01-01 12:35:08 |
| 48 | Code |
| 49 | # Colonnade |
| 50 | ctl_colonnade(list(a = 1:3), has_row_id = FALSE) |
| 51 | Output |
| 52 | $body |
| 53 | a |
| 54 | <int> |
| 55 | 1 |
| 56 | 2 |
| 57 | 3 |
| 58 | |
| 59 | $extra_cols |
| 60 | list() |
| 61 | |
| 62 | $abbrev_cols |
| 63 | character(0) |
| 64 | |
| 65 | $abbrev_col_idxs |
| 66 | numeric(0) |
| 67 | |
| 68 | Code |
| 69 | ctl_colonnade(list(a = 1:3)) |
| 70 | Output |
| 71 | $body |
| 72 | a |
| 73 | <int> |
| 74 | 1 1 |
| 75 | 2 2 |
| 76 | 3 3 |
| 77 | |
| 78 | $extra_cols |
| 79 | list() |
| 80 | |
| 81 | $abbrev_cols |
| 82 | character(0) |
| 83 | |
| 84 | $abbrev_col_idxs |
| 85 | numeric(0) |
| 86 | |
| 87 | |
| 88 | # body: output for wide characters |
| 89 | |
| 90 | Code |
| 91 | x <- c("成交日期", "合同录入日期") |
| 92 | df <- new_tbl(setNames(list(1:3, 4:6), x)) |
| 93 | print(df, n = 8L, width = 60L) |
| 94 | Output |
| 95 | # A data frame: 3 × 2 |
| 96 | 成交日期 合同录入日期 |
| 97 | <int> <int> |
| 98 | 1 1 4 |
| 99 | 2 2 5 |
| 100 | 3 3 6 |
| 101 |