co-analysis / a11ytables

R package: generate best-practice stats spreadsheets for publication
https://co-analysis.github.io/a11ytables/
Other
40 stars 3 forks source link

`generate_workbook` produces error #110

Closed jonathonmellor closed 1 month ago

jonathonmellor commented 7 months ago

a11ytables::generate_workbook(example_a11ytable) Produces Error in nchar(x) : 'nchar()' requires a character vector

Using version 0.2.0

matt-dray commented 7 months ago

Cracking, thank you. As discussed, this seems to have been introduced in v0.2.0 and I think it's probably related to the checking/insertion of terminal periods (for accessibility purposes), which was adapted when introducing functionality for hyperlinks. You mentioned your error occurs whether supplying a dataframe or a list of cover information, so the issue is unlikely to be tied to that new functionality in particular.

jonathonmellor commented 1 month ago

I hit this issue again today, or at least an nchar problem. Changing my tables to not have factors resolved the issue. Is it perhaps worth documenting somewhere that the user should coerce columns into characters before passing to a11ytables?

I wanted to change some ordering on my end for some dataframes, so went to factor, which broken things and was a bit of a challenge to debug.

matt-dray commented 1 month ago

Oops, I added #113 and somehow it's five months later. I'd like to address this soon in the code, but for sure it will get some documentation if that fails. Thank you again for prompting!

matt-dray commented 1 month ago

Hi @jonathonmellor, this should now be fixed in #127 (the max character length of a column is used to decide if the column should be widened in the output spreadsheet, but nchar() doesn't actually accept factors). Hopefully that fixes the issue; let me know if you still have problems after installing the newly-released v0.3.2.