Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Laurent,
This PR has a set of commits to (potentially) improve
etable
. Here's the set of changes:div.class
is an option forsetFixest_etable
to matchmarkdown
.etable(..., file = path)
fails whenpath
has a directory that doesn't exist. This PR checks for this and creates the directory if needed.Fix a sort of nefarious bug with
export
. Say you haveetable(..., export = path)
wherepath
is a relative directory, the directory does not exist, andmarkdown = FALSE
. The functioncheck_set_path
will return the relative path back. However, building the png sets the working directory totempdir()
, so moving the png topath
fails.Allowing for named exports How do you name the PNG file that etable exports? #451
To do this, the file name is extracted if it exists (and with the fix to 3) and used as
png_name
.The controversial change involves
markdown
processing. I can remove this one if you don't agree.Rmarkdown and quarto (both using knitr) saves
plot
s inknitr::fig_path()
(usuallyX_files/figures-html/
). Putting the etable pngs in here gives the benefit of allowingself_contained
to process them.Quarto/
knitr
has the optionoutput.dir
which lets your execution working directory differ from where the output is created. You can access this withknitr::opts_knit$get("output.dir")
. This means with this option, the images produced byetable
won't be in the correct location of thehtml
document.For example, if I have a .Rmd in a subfolder (e.g.
./vignettes/
) but I want it use the main folder (./
) as the working directory,etable
will use./etable/images/
instead of./vignettes/etable/images
.By using these two functions, I think etable much better ties in with quarto/rmarkdown. I've faced this problem with my own day-to-day use of qmd, so it's not just a random edge case (or maybe I'm the edge case).