Skip to content

Commit

Permalink
add method for S4 matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunuuuu committed Jan 1, 2025
1 parent b7a9f47 commit a65b355
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ S3method(element_vec_fields,element_text)
S3method(element_vec_fields,ggalign_element_polygon)
S3method(format,ggalign_area)
S3method(fortify_data_frame,"NULL")
S3method(fortify_data_frame,DelayedMatrix)
S3method(fortify_data_frame,Matrix)
S3method(fortify_data_frame,character)
S3method(fortify_data_frame,complex)
S3method(fortify_data_frame,default)
Expand Down
10 changes: 10 additions & 0 deletions R/fortify-data_frame.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,13 @@ fortify_data_frame.matrix <- function(data, ...) {
if (!is.null(col_nms)) data$.column_names <- col_nms[data$.column_index]
data
}

#' @export
fortify_data_frame.DelayedMatrix <- function(data, ...) {
fortify_data_frame(as.matrix(data))
}

#' @export
fortify_data_frame.Matrix <- function(data, ...) {
fortify_data_frame(as.matrix(data))
}

0 comments on commit a65b355

Please sign in to comment.