Skip to content

Commit

Permalink
Possibly fix #256: use double values in arrange_spans() to avoid in…
Browse files Browse the repository at this point in the history
…teger overflow on large huxtables
  • Loading branch information
hughjonesd committed Jul 25, 2024
1 parent cbb3a7f commit 0dc5017
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions R/subset-extract-internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ replace_properties <- function (ht, i, j, value) {
#' @param new_ht New huxtable, row/colspans not yet set
#' @param old_ht Subsetted huxtable
#' @param rows,cols Which rows/cols are being subsetted
#' @param cols
#'
#' @return The new huxtable with row and colspans set correctly.
#' @noRd
Expand All @@ -184,7 +183,7 @@ arrange_spans <- function (

dc <- display_cells(old_ht)
stride <- max(dim(old_ht))
merge_sets <- dc$display_row * stride + dc$display_col
merge_sets <- as.double(dc$display_row) * stride + dc$display_col
dim(merge_sets) <- dim(old_ht)

# == create within-span indices ==
Expand All @@ -202,7 +201,6 @@ arrange_spans <- function (
# merge_set and colspan will erroneously be set on them
merge_sets <- merge_sets[rows, cols, drop = FALSE]


# == calculate row/col_number for new_ht ==
row_number <- row_number[rows, cols, drop = FALSE]
col_number <- col_number[rows, cols, drop = FALSE]
Expand Down

0 comments on commit 0dc5017

Please sign in to comment.