Skip to content

Commit

Permalink
fix: footnote() handle undefined ref_symbols argument
Browse files Browse the repository at this point in the history
fix #596
  • Loading branch information
davidgohel committed Jan 9, 2024
1 parent f6e4dbc commit b25eb13
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: flextable
Type: Package
Title: Functions for Tabular Reporting
Version: 0.9.5.005
Version: 0.9.5.006
Authors@R: c(
person("David", "Gohel", role = c("aut", "cre"),
email = "[email protected]"),
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- `summarizor()` don't stop anymore if table only contain discrete columns.
- `as_flextable.data.frame()` supports 'data.table'
- `footnote()` handle undefined `ref_symbols` argument

## Changes

Expand Down
8 changes: 4 additions & 4 deletions R/footnote.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ footnote <- function(x, i = NULL, j = NULL, value, ref_symbols = NULL, part = "b
symbols_str <- ref_symbols
}

if (any(ref_symbols %in% "")) {
if (any(symbols_str %in% "")) {
long_msg <- c(
"Usage of empty symbol '' with footnote should not happen, ",
"use `add_footer_lines()` instead, it does not require any symbol. ",
Expand Down Expand Up @@ -144,7 +144,7 @@ footnote <- function(x, i = NULL, j = NULL, value, ref_symbols = NULL, part = "b
}

paras <- mapply(rbind,
as_paragraph(as_sup(ref_symbols)),
as_paragraph(as_sup()),
value,
as_paragraph(sep_str),
SIMPLIFY = FALSE
Expand All @@ -158,14 +158,14 @@ footnote <- function(x, i = NULL, j = NULL, value, ref_symbols = NULL, part = "b
}
} else {
# init new lines
x <- add_footer_lines(x, values = ref_symbols)
x <- add_footer_lines(x, values = symbols_str)
for (v in seq_along(value)) {
# `[<-.chunkset_struct`
x[["footer"]]$content[n_row + v, j = 1] <- value[v]
x <- prepend_chunks(
x = x, i = n_row + v, j = 1,
part = "footer",
as_sup(ref_symbols[v]) # [ as we want a list of df
as_sup(symbols_str[v]) # [ as we want a list of df
)
}
}
Expand Down

0 comments on commit b25eb13

Please sign in to comment.