grateful
grateful copied to clipboard
Quarto user bugs (working directory, `kableExtra`, and warning messages)
Discussed in https://github.com/Pakillo/grateful/discussions/49
I have just put this through as a discussion but thought I would report this as a bug as well. Perhaps it closely meets the definition of a bug.
Originally posted by mitchellcameron123 August 2, 2024 Hi,
First of all, thank you for making this outstanding package!
I am a quarto user and I have found a few issues that could be clarified in the documentation (hence I am putting this through as an idea). Perhaps these are "bugs" so I am happy to put through a bug report as well.
First, your documentation advises " It is recommended to set out.dir = getwd().". Running quarto render (in the terminal such as for publishing) will lead to an error. Perhaps the documentation should state that out.dir = tempdir() is required in this case. Regardless of quarto, I feel this should be clarified as the description in the help file (?cite_packages) states that getwd() is recommended by then the coded examples state tempdir().
Second, the kableExtra package doesnt process the citations. This is a general problem in quarto and citations in tables here. Perhaps the package documentation could provide a workaround similar too:
#| output: asis
pkgs <- cite_packages(output = "table", tempdir())
kbl(pkgs, booktabs = T, align = "c") %>%
kable_styling(full_width = T) %>%
unclass() %>% cat()
Third, when a large number of packages are detected, the warning suggests that options(renv.config.dependencies.limit = Inf) is used. However, in quarto at least (perhaps other formats), this will lead to an error. The warning can be resolved by setting it to be sufficiently high instead of inf such asoptions(renv.config.dependencies.limit = 10000).
I hope these points are helpful for quarto users to be aware of in your documentation. I realise these may be niche cases, but additional documentation may save users some time figuring this all out.
Kind regards,
Hi Mitchell
Thanks a lot for your contribution. I've improved the documentation following your suggestions.
I've added a FAQ here on overcoming the renv warning with large numbers of packages.
I've also added an example of producing a table within Quarto or Rmarkdown here but using knitr::kable(). I've found kableExtra to be inconsistent (cf.). Your suggested code seems to only work with html output, but not PDF. I might add a FAQ on producing tables with kableExtra but I'd need to cover different formats as well as Rmd and Quarto... I hope instead the existing issues are fixed upstream meanwhile. knitr::kable() works nice always. gt is another option.
Finally, I have tried with out.dir = ".", getwd(), and tempdir() and it worked for me in all cases (in Quarto), so I'm afraid I can't reproduce your problem. The "tempdir" thing was a requirement from CRAN, I still think the working directory is a sensible choice for out.dir...
Hi,
Thanks very much. I've ended up using knitr::kable() anyway due to this shortfall.
Interesting that you cant reproduce the example with the directory. To clarify, I experience this issue specifically when using quarto render in the terminal but not clicking render (as clicking render is really just a preview).
Thanks,
Yes, I have tried running quarto render from the terminal for this example qmd and it runs for me, for both html and pdf output.
Can you share the error message when trying render? That should help us identify the problem
From the untouched qmd file i get the following error
ERROR: The specified directory ('.') is not a Quarto project.
(If you have not specified a path, quarto will attempt to render the entire current directory as a project.)
Stack trace:
(If you have not specified a path, quarto will attempt to render the entire current directory as a project.)
at render (file:///C:/Users/mitch/AppData/Local/Programs/Quarto/bin/quarto.js:82907:19)
at async Command.actionHandler (file:///C:/Users/mitch/AppData/Local/Programs/Quarto/bin/quarto.js:83066:32)
at async Command.execute (file:///C:/Users/mitch/AppData/Local/Programs/Quarto/bin/quarto.js:8017:13)
at async Command.parseCommand (file:///C:/Users/mitch/AppData/Local/Programs/Quarto/bin/quarto.js:7907:20)
at async quarto (file:///C:/Users/mitch/AppData/Local/Programs/Quarto/bin/quarto.js:118208:9)
at async file:///C:/Users/mitch/AppData/Local/Programs/Quarto/bin/quarto.js:118227:9
at async mainRunner (file:///C:/Users/mitch/AppData/Local/Programs/Quarto/bin/quarto.js:118112:9)
at async file:///C:/Users/mitch/AppData/Local/Programs/Quarto/bin/quarto.js:118218:5
using getwd() I get the identical error
Thanks Mitchell.
Can you share your quarto version (quarto -v) and commands (quarto render grateful-Quarto.qmd in my case)? Based on this is it possible that you are adding other arguments to quarto render and it gets confused?
Closing this, assuming it was already sorted out. But please feel free to re-open or open new issues if you found more problems.
Cheers