Skip to content

Commit

Permalink
Once more for 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Sep 6, 2024
1 parent d0b75f0 commit 02dc38b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/wrap_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,16 @@ patchGrob.wrapped_table <- function(x, guides = 'auto') {
table_width <- table_width[-(1:row_head)]
}
if (!space[1]) {
x$widths[PANEL_COL] <- if (inherits(table_width, "simpleUnit")) sum(table_width) else Reduce(`+`, table_width)
# Something wonky is going on with unit addition sometimes where it looses
# it's unit type. So we make a dance to make sure
w <- if (inherits(table_width, "simpleUnit")) sum(table_width) else Reduce(`+`, table_width)
if (!is.unit(w)) w <- unit(w, unitType(table_width)[1])
x$widths[PANEL_COL] <- w
}
if (!space[2]) {
x$heights[PANEL_ROW] <- if (inherits(table_height, "simpleUnit")) sum(table_height) else Reduce(`+`, table_height)
h <- if (inherits(table_height, "simpleUnit")) sum(table_height) else Reduce(`+`, table_height)
if (!is.unit(h)) h <- unit(h, unitType(table_height)[1])
x$heights[PANEL_ROW] <- h
}
x
}
Expand Down

0 comments on commit 02dc38b

Please sign in to comment.