These functions use the active LLM to assist with writing and reviewing R Markdown and Quarto documents. Each call uses an isolated chat context.
llm_review_document() reviews a document for language, structure, or
completeness and returns Dutch-language feedback.
llm_write_section() writes a Dutch section (e.g. Methods, Results) for
a report, presentation, or article.
llm_write_chunk() generates or improves an R code chunk for a document.
llm_review_document(
file = NULL,
text = NULL,
focus = c("all", "language", "structure", "completeness"),
new = FALSE,
...
)
llm_write_section(
section,
data = NULL,
context = NULL,
style = c("report", "presentation", "article"),
new = FALSE,
...
)
llm_write_chunk(code = NULL, goal = NULL, new = FALSE, ...)Path to an .Rmd or .qmd file. The first 3000 lines are read.
Either file or text must be supplied.
The document content as a character string. Either file or
text must be supplied.
What to focus on during review: "language", "structure",
"completeness", or "all" (default).
Logical. If TRUE, re-initiates the LLM before the task call.
Default is FALSE.
Additional arguments passed to the LLM chat method.
Name of the section to write, e.g. "Methods", "Results",
"Discussion".
Optional data frame providing context for the section. Summarised before sending to the LLM.
Optional character string with additional background context for the section (e.g. a description of the analysis).
Document style: "report" (default), "presentation", or
"article".
Optional existing R code to improve (as a character string).
Description of what the code chunk should accomplish. Required
when code is NULL.
A character string with the generated or reviewed text.