save_as_html using 'dynamic' list of ft objects #709
-
|
Hi. I'm trying to use the save_as_html function. The twist is that I won't know the exact names of the ft objects to pass as a list. Anybody know what I'm doing wrong? Now I'm trying to create a list to pass. The final requirement is that the list is created by finding any ft_ objects in the environment (there may be 2, there may be 20) |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
|
This is ugly, but works. Create a text string that mimics the command. ftList <- paste(sort(ls(pattern="ft_")), collapse=",") codeText <- paste0("save_as_html(", ftList, ", ", "path=paste0(rootDir, 'Validation/Outputs/', TIDList[i], '.html'), ", eval(parse(text=codeText)) codeText roughly translates to save_as_html(ft_1, ft_2, ft_3, etc. , path=some defined location + filename + .html, I can't believe there isn't an easier way? |
Beta Was this translation helpful? Give feedback.
-
|
use argument
See the documentation here: https://davidgohel.github.io/flextable/reference/save_as_html.html |
Beta Was this translation helpful? Give feedback.
-
|
Hi David. Sorry, I'm not explaining. The document shows providing a list
of objects, or named pair list. But from the example, they are 'known' and
just typed as code.
I need to create a list of ft objects using ls(pattern=) because I don't
know what ft objects will need to be saved as html at time of execution.
I've tried list(ft1, ft2, etc.) but that doesn't work. So what is the
syntax to pass a 'list' of ft objects can can be constructed and stored as
a variable? ftList <- list(ls(pattern="ft")) mget? eval? I"m not an
expert, I just know I'ved tried every way I can think of to do this, and
all I get is a blank html page with just the title.
regards
…On Tue, Nov 11, 2025 at 8:46 PM David Gohel ***@***.***> wrote:
use argument values of function save_as_html():
a list (possibly named), each element is a flextable object. If named
objects, names are used as titles. If provided, argument ... will be
ignored.
See the documentation here:
https://davidgohel.github.io/flextable/reference/save_as_html.html
—
Reply to this email directly, view it on GitHub
<#709 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABWXT25CT5J5RLDBQILU3XD34IVIVAVCNFSM6AAAAACLSAE53KVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTIOJTHEZDMMY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Next time you submit an issue, provide a reproducible example. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you so much David. I see that 'reproducible' is more formal than I had done. regards |
Beta Was this translation helpful? Give feedback.
use argument
valuesof functionsave_as_html():See the documentation here: https://davidgohel.github.io/flextable/reference/save_as_html.html