davidgohel / flextable

table farming
https://ardata-fr.github.io/flextable-book/
554 stars 79 forks source link

footnote() returns "subscript out of bounds" error when ref_symbols not defined #596

Closed biotronette closed 8 months ago

biotronette commented 9 months ago

The footnote() function returns an error when ref_symbols is not defined. The error has nothing to do with the dimensions of the data in question, as the function works as expected when ref_symbols is given.

This does not work: tab <- data.frame('col1' = paste('value',1:10,sep ='_'), 'col2' = paste('other_value',11:20,sep='_')) |> flextable() |> footnote(i = 1, j = 1, value = as_paragraph('This is the footnote')) Error returned: Error in '[<-'('\*tmp\*', i, j, value = value) : subscript out of bounds

But this does: tab <- data.frame('col1' = paste('value',1:10,sep ='_'), 'col2' = paste('other_value',11:20,sep='_')) |> flextable() |> footnote(i = 1, j = 1, value = as_paragraph('This is the footnote'),ref_symbols = 'a')

It's not clear from the documentation that the functionality of this feature is dependent on user specification of the ref_symbols parameter, and the error does not give any clues as to what the fix might be. Recommend enabling a default value for ref_symbols to avoid this issue.

Using version 0.9.4.

davidgohel commented 8 months ago

thanks, it should be fixed now

github-actions[bot] commented 2 months ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.