This works fine for both...
## PNG
mtcars %>% gt() %>% gtsave(
filename = 'mtcars_gtsave.png'
# , path = 'assets'
)
### HTML
mtcars %>% gt() %>% gtsave(
filename = 'mtcars_gtsave.html'
# , path = 'assets'
)
...but uncomment path args and the html file will fail to get written...
## PNG
mtcars %>% gt() %>% gtsave(
filename = 'mtcars_gtsave.png'
, path = 'assets'
)
### HTML
mtcars %>% gt() %>% gtsave(
filename = 'mtcars_gtsave.html'
, path = 'assets'
)
Here is the error:
Error in base::file(file, open = "w+b") : cannot open the connection
In addition: Warning message:
In base::file(file, open = "w+b") :
cannot open file 'assets/mtcars_gtsave.html': No such file or directory
Just a question: when you were trying this, did assets directory exist in your working directory? The reason I ask is because I don't believe gtsave() will create new directories for you. However, even if that's the case, I believe there should at least be an error message here stating as much. And that's on me.
I have the same issue and I confirmed that my folder did indeed exist before running this, also when running the following instead of using path=output_folder:
coefs_tbl %>% gt() %>% gtsave(glue("{output_path}/table_lsdv.html"))
This one should have the bug label @rich-iannone
I believe the bug is upstream here https://github.com/rstudio/htmltools/issues/165
@kendonB I agree! Will change the labels on this and fix soon.
Hello
I just installed the dev version from github and I still have the problem:
gtsave(filename = "02_tableau_1.html", path = "3-R-ACM")
Error in base::file(file, open = "w+b") :
impossible d'ouvrir la connexion
De plus : Warning message:
In base::file(file, open = "w+b") :
impossible d'ouvrir le fichier '3-R-ACM/02_tableau_1.html' : No such file or directory
the folder 3-R_ACM exists in my Rproject. The error occurs both with a .R or a Rmdfile, whether it is stored in the root folder or in the target folder 3-R_ACM .
Thanks !
Most helpful comment
I have the same issue and I confirmed that my folder did indeed exist before running this, also when running the following instead of using
path=output_folder:coefs_tbl %>% gt() %>% gtsave(glue("{output_path}/table_lsdv.html"))