Skip to content

Commit

Permalink
use data_frame0
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunuuuu committed Jul 18, 2024
1 parent 866fc14 commit ed7221e
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 13 deletions.
4 changes: 3 additions & 1 deletion R/anno-.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ methods::setClass(
)
)

#' Show `anno` object
#' @param object A `anno` object.
#' @importFrom methods show
#' @export
#' @rdname anno
#' @keywords internal
methods::setMethod("show", "anno", function(object) {
print(sprintf("A %s object", fclass(object)))
invisible(object)
Expand Down
2 changes: 1 addition & 1 deletion R/anno-build.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ anno_build_data <- function(data, panels, index, position) {
data <- as_tibble0(data, rownames = ".row_names")
data$.row_index <- seq_len(nrow(data))
}
coords <- tibble0(.panel = panels[index], .index = index)
coords <- data_frame0(.panel = panels[index], .index = index)
coords[[paste0(".", to_coord_axis(position))]] <- seq_along(index)
merge(data, coords,
by.x = ".row_index", by.y = ".index",
Expand Down
4 changes: 2 additions & 2 deletions R/plot-build.R
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,12 @@ ggheat_default_scale <- function(scale_name, panels, index, labels, nudge,

ggheat_build_data <- function(matrix, row_panels, row_index,
column_panels, column_index) {
row_coords <- tibble0(
row_coords <- data_frame0(
.row_panel = row_panels[row_index],
.row_index = row_index,
.y = seq_along(row_index)
)
column_coords <- tibble0(
column_coords <- data_frame0(
.column_panel = column_panels[column_index],
.column_index = column_index,
.x = seq_along(column_index)
Expand Down
8 changes: 4 additions & 4 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ data_frame0 <- function(...) {
quickdf(list(...))
}

quickdf <- function(l) {
class(l) <- "data.frame"
attr(l, "row.names") <- .set_row_names(length(l[[1]]))
l
quickdf <- function(x) {
class(x) <- "data.frame"
attr(x, "row.names") <- .set_row_names(length(.subset2(x, 1L)))
x
}

as_tibble0 <- function(data, ...) {
Expand Down
5 changes: 0 additions & 5 deletions man/anno.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions man/show-anno-method.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ed7221e

Please sign in to comment.