diff --git a/R/anno-.R b/R/anno-.R index 14a87ea8..2f2ecc38 100644 --- a/R/anno-.R +++ b/R/anno-.R @@ -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) diff --git a/R/anno-build.R b/R/anno-build.R index 992a8943..4835ea63 100644 --- a/R/anno-build.R +++ b/R/anno-build.R @@ -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", diff --git a/R/plot-build.R b/R/plot-build.R index eae1ad14..7a44da2a 100644 --- a/R/plot-build.R +++ b/R/plot-build.R @@ -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) diff --git a/R/utils.R b/R/utils.R index c3231fb4..13441721 100644 --- a/R/utils.R +++ b/R/utils.R @@ -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, ...) { diff --git a/man/anno.Rd b/man/anno.Rd index 88ffdfaf..077bae24 100644 --- a/man/anno.Rd +++ b/man/anno.Rd @@ -2,7 +2,6 @@ % Please edit documentation in R/anno-.R \name{anno} \alias{anno} -\alias{show,anno-method} \title{Create a heatmap annotation object} \usage{ anno( @@ -18,8 +17,6 @@ anno( name = NULL, call = caller_call() ) - -\S4method{show}{anno}(object) } \arguments{ \item{Class}{Sub-class of \code{anno}.} @@ -73,8 +70,6 @@ set the active context to current annotation for the annotation list in \item{name}{A string of the annotation name.} \item{call}{The \code{call} used to construct the scale for reporting messages.} - -\item{object}{A \code{anno} object.} } \value{ A new \code{Class} object. diff --git a/man/show-anno-method.Rd b/man/show-anno-method.Rd new file mode 100644 index 00000000..861965f0 --- /dev/null +++ b/man/show-anno-method.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/anno-.R +\name{show,anno-method} +\alias{show,anno-method} +\title{Show \code{anno} object} +\usage{ +\S4method{show}{anno}(object) +} +\arguments{ +\item{object}{A \code{anno} object.} +} +\description{ +Show \code{anno} object +} +\keyword{internal}