|
1 | 1 | # This file is a replacement of the unexported functions in the tibble package, in order to specify "tibble abstraction in the header" |
2 | 2 |
|
3 | | -#' tbl_format_header |
| 3 | +#' Format the header of a tibble |
| 4 | +#' |
| 5 | +#' @description |
| 6 | +#' `r lifecycle::badge("experimental")` |
| 7 | +#' |
| 8 | +#' For easier customization, the formatting of a tibble is split |
| 9 | +#' into three components: header, body, and footer. |
| 10 | +#' The `tbl_format_header()` method is responsible for formatting the header |
| 11 | +#' of a tibble. |
| 12 | +#' |
| 13 | +#' Override this method if you need to change the appearance |
| 14 | +#' of the entire header. |
| 15 | +#' If you only need to change or extend the components shown in the header, |
| 16 | +#' override or extend [tbl_sum()] for your class which is called by the |
| 17 | +#' default method. |
4 | 18 | #' |
5 | | -#' @rdname tbl_format_header-methods |
6 | | -#' @name tbl_format_header |
7 | 19 | #' @importFrom pillar tbl_format_header |
| 20 | +#' @inheritParams tbl_format_body |
| 21 | +#' @inherit tbl_format_body return |
8 | 22 | #' |
9 | | -#' @noRd |
| 23 | +#' @rdname tbl_format_header-methods |
| 24 | +#' @name tbl_format_header |
10 | 25 | #' |
11 | 26 | #' @export |
| 27 | +#' |
| 28 | +NULL |
12 | 29 | NULL |
13 | 30 |
|
14 | 31 | #' @importFrom rlang names2 |
@@ -113,12 +130,13 @@ NULL |
113 | 130 | #' @rdname print |
114 | 131 | #' @importFrom cli cat_line |
115 | 132 | #' @importFrom SingleCellExperiment counts |
| 133 | +#' @importFrom vctrs new_data_frame |
116 | 134 | #' @export |
117 | 135 | print.SingleCellExperiment <- function(x, ..., n = NULL, width = NULL, n_extra = NULL) { |
118 | 136 |
|
119 | 137 | x |> |
120 | 138 | as_tibble(n_dimensions_to_return = 5) |> |
121 | | - vctrs::new_data_frame(class = c("tidySingleCellExperiment", "tbl")) %>% |
| 139 | + new_data_frame(class = c("tidySingleCellExperiment", "tbl")) %>% |
122 | 140 | add_attr( nrow(x), "number_of_features") %>% |
123 | 141 | add_attr( assays(x) %>% names , "assay_names") %>% |
124 | 142 | print() |
|
0 commit comments