Replies: 4 comments 3 replies
-
Beta Was this translation helpful? Give feedback.
-
I am sorry, but this is not working for. Below I offer some code, in the form of 6 tests. Each tries to represent the smallest possible incremental change.
Test1 works "Dear Sister Sledge" in the output. Now, let's do the same but from a tibble
Test 2 works, but we didn't include the execute_params, but ... got the output filename correct
Dies here " render params argument must be a named list R replies with: Fails: "params argument must be a named list But str(test_3) sure look like it is a named list tibble [1 × 4] (S3: tbl_df/tbl/data.frame) Test 4 Tries to add two params (but for a 1 record df)
Test 5 tries to extend this to one parameter, but multiple rows of input:
Test 5 fails Test 6 Here I am trying to use multiple rows, nd multiple parameters
Test 6 fails, but that's not surprising. Need to fix test_3 first. |
Beta Was this translation helpful? Give feedback.
-
Here you don't provide the actual Quarto document you are using. That said, the following reproducible examples work perfectly fine, thus there is a syntax error or another type of error in your code, which is unrelated to Quarto (R package or CLI). ---
title: '`r params[["title"]]`'
params:
title: "Default"
format: html
---
Text library(quarto)
lapply(
X = head(letters),
FUN = function(i) {
quarto_render(
input = "test.qmd",
output_file = paste0("test_", i, ".html"),
execute_params = list(
title = paste("Test", toupper(i))
)
)
}
) library(quarto)
library(purrr)
library(tibble)
pmap(
.l = tibble(
output_file = c("test_a.html", "test_b.html"),
execute_params = list(
list(title = "Test A"),
list(title = "Test B")
)
),
.f = function(output_file, execute_params) {
quarto_render(
input = "test.qmd",
output_file = output_file,
execute_params = execute_params
)
}
) library(quarto)
library(purrr)
library(tibble)
pmap(
.l = tibble(
output_file = c("test_a.html", "test_b.html"),
execute_params = list(
list(title = "Test A"),
list(title = "Test B")
)
),
.f = quarto_render,
input = "test.qmd"
) |
Beta Was this translation helpful? Give feedback.
-
Mickael, Your note was perfectly clear. What is needed, I am suggesting, is a more accessible way to get columns out of a df and into params, Your approach is technically lovely, but it would be easier for lay folk if the syntax was more accessible.
Ideally (for me) the pmap call would be pmap(df, quarto_render) and all the other details would be addressed in structuring the input df. I really appreciate your assistance. I suppose another approach would be to writing run-specific yaml files to set the params, but that seemed unnecessarily indirect. Parameterized reports in Quarto will be a big deal, if we can do them easily from within the quarto_render function. Again, my thanks and appreciation. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to take vars from a df and use them as params in a call to quarto_render:
This approach works if I don't include execute_params (which was the point) but fails when I do. My guess is that either the
one_person is not structured properly, or the execute_params is incorrectly specified.
This is the failure I get;
Error in knit_params_get(input_lines, params) : render params argument must be a named list Calls: .main -> execute -> -> knit_params_get Execution halted Error in
pmap()
: ℹ In index: 1. Caused by error: ! System command 'quarto' failed Runrlang::last_error()
to see where the error occurred.--
Beta Was this translation helpful? Give feedback.
All reactions