These functions use the active LLM to assist with data analysis and R code tasks. Each call uses an isolated chat context. Generated code is returned as a character string for the user to review and run manually.

  • llm_analyse() suggests analyses or answers a question about a dataset.

  • llm_code() generates R code for a described task.

  • llm_explain() explains R code in Dutch.

  • llm_suggest_plot() suggests a plot2() call for a dataset.

llm_analyse(data, question = NULL, new = FALSE, ...)

llm_code(data = NULL, task, style = c("tidyverse", "base"), new = FALSE, ...)

llm_explain(code, detail = c("brief", "detailed"), new = FALSE, ...)

llm_suggest_plot(data, goal = NULL, new = FALSE, ...)

Arguments

data

A data frame. Summarised before sending to the LLM; raw rows are never sent verbatim.

question

A specific question about the data. If NULL, the LLM is asked to suggest appropriate analyses.

new

Logical. If TRUE, re-initiates the LLM before the task call. Default is FALSE.

...

Additional arguments passed to initiate_llm().

task

Description of what the R code should accomplish.

style

Coding style for generated R code: "tidyverse" (default) or "base".

code

A character string containing R code to explain or improve.

detail

Level of detail for explanations: "brief" (one paragraph, default) or "detailed" (step-by-step).

goal

Optional description of what the plot should show.

Value

A character string with the LLM response (suggestions, code, or explanation).